cxppython 0.0.3__tar.gz → 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cxppython-0.0.3 → cxppython-0.1.0}/PKG-INFO +1 -1
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython/utils/database/mysql.py +8 -4
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython.egg-info/PKG-INFO +1 -1
- {cxppython-0.0.3 → cxppython-0.1.0}/setup.py +1 -1
- {cxppython-0.0.3 → cxppython-0.1.0}/LICENSE +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/README.md +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython/__init__.py +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython/core/__init__.py +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython/core/config.py +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython/main.py +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython/utils/__init__.py +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython/utils/btlogging/__init__.py +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython/utils/btlogging/console.py +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython/utils/btlogging/defines.py +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython/utils/btlogging/format.py +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython/utils/btlogging/helpers.py +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython/utils/btlogging/loggingmachine.py +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython/utils/database/__init__.py +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython/utils/easy_imports.py +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython.egg-info/SOURCES.txt +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython.egg-info/dependency_links.txt +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython.egg-info/requires.txt +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/cxppython.egg-info/top_level.txt +0 -0
- {cxppython-0.0.3 → cxppython-0.1.0}/setup.cfg +0 -0
|
@@ -27,9 +27,6 @@ class MysqlDB:
|
|
|
27
27
|
|
|
28
28
|
@staticmethod
|
|
29
29
|
def session() -> Session:
|
|
30
|
-
# engine = DB.__instance.engine
|
|
31
|
-
# session = sessionmaker(bind=engine)
|
|
32
|
-
# return session()
|
|
33
30
|
session = MysqlDB.__instance.session
|
|
34
31
|
return session()
|
|
35
32
|
|
|
@@ -66,6 +63,7 @@ class MysqlDB:
|
|
|
66
63
|
# 尝试建立连接
|
|
67
64
|
with MysqlDB.instance().engine.connect() as connection:
|
|
68
65
|
cc.logging.success("Database connection successful!")
|
|
66
|
+
connection.commit()
|
|
69
67
|
return True
|
|
70
68
|
except OperationalError as e:
|
|
71
69
|
cc.logging.error(f"Failed to connect to the database: {e}")
|
|
@@ -96,7 +94,13 @@ class MysqlDB:
|
|
|
96
94
|
stmt = insert(model).values(batch)
|
|
97
95
|
if ignore_existing:
|
|
98
96
|
stmt = stmt.prefix_with("IGNORE")
|
|
99
|
-
|
|
97
|
+
|
|
98
|
+
try:
|
|
99
|
+
session.execute(stmt)
|
|
100
|
+
except Exception as e:
|
|
101
|
+
cc.logging.error(f"Batch insert failed at index {i}: {e}")
|
|
102
|
+
session.rollback()
|
|
103
|
+
raise
|
|
100
104
|
|
|
101
105
|
if commit_per_batch:
|
|
102
106
|
session.commit()
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="cxppython", # 包名
|
|
5
|
-
version="0.0
|
|
5
|
+
version="0.1.0", # 版本号
|
|
6
6
|
packages=find_packages(exclude=["tests", "tests.*"]), # 自动找到所有包
|
|
7
7
|
description="A python utils package",
|
|
8
8
|
long_description=open("README.md").read(),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|