mdbq 3.3.12__py3-none-any.whl → 3.3.13__py3-none-any.whl
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.
mdbq/mysql/mysql.py
CHANGED
@@ -128,7 +128,7 @@ class MysqlUpload:
|
|
128
128
|
|
129
129
|
return wrapper
|
130
130
|
|
131
|
-
def keep_connect(self, _db_name, _config, max_try: int=
|
131
|
+
def keep_connect(self, _db_name, _config, max_try: int=10):
|
132
132
|
attempts = 1
|
133
133
|
while attempts <= max_try:
|
134
134
|
try:
|
@@ -137,7 +137,7 @@ class MysqlUpload:
|
|
137
137
|
except Exception as e:
|
138
138
|
print(f'连接失败,正在重试: {attempts}/{max_try} {e}')
|
139
139
|
attempts += 1
|
140
|
-
time.sleep(
|
140
|
+
time.sleep(30)
|
141
141
|
print(f'{_db_name}: 连接失败,重试次数超限,当前设定次数: {max_try}')
|
142
142
|
return None
|
143
143
|
|
@@ -215,7 +215,7 @@ class MysqlUpload:
|
|
215
215
|
return
|
216
216
|
|
217
217
|
# connection = pymysql.connect(**self.config) # 连接数据库
|
218
|
-
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=
|
218
|
+
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=10)
|
219
219
|
if not connection:
|
220
220
|
return
|
221
221
|
with connection.cursor() as cursor:
|
@@ -236,7 +236,7 @@ class MysqlUpload:
|
|
236
236
|
|
237
237
|
self.config.update({'database': db_name}) # 添加更新 config 字段
|
238
238
|
# connection = pymysql.connect(**self.config) # 重新连接数据库
|
239
|
-
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=
|
239
|
+
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=10)
|
240
240
|
if not connection:
|
241
241
|
return
|
242
242
|
with connection.cursor() as cursor:
|
@@ -386,7 +386,7 @@ class MysqlUpload:
|
|
386
386
|
print(f'{table_name} 将数据按年/月保存(cut_data),但在转换日期时报错 -> {e}')
|
387
387
|
|
388
388
|
# connection = pymysql.connect(**self.config) # 连接数据库
|
389
|
-
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=
|
389
|
+
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=10)
|
390
390
|
if not connection:
|
391
391
|
return
|
392
392
|
with connection.cursor() as cursor:
|
@@ -407,7 +407,7 @@ class MysqlUpload:
|
|
407
407
|
|
408
408
|
self.config.update({'database': db_name}) # 添加更新 config 字段
|
409
409
|
# connection = pymysql.connect(**self.config) # 重新连接数据库
|
410
|
-
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=
|
410
|
+
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=10)
|
411
411
|
if not connection:
|
412
412
|
return
|
413
413
|
with connection.cursor() as cursor:
|
@@ -597,7 +597,7 @@ class MysqlUpload:
|
|
597
597
|
print(f'{table_name} 将数据按年/月保存(cut_data),但在转换日期时报错 -> {e}')
|
598
598
|
|
599
599
|
# connection = pymysql.connect(**self.config) # 连接数据库
|
600
|
-
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=
|
600
|
+
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=10)
|
601
601
|
if not connection:
|
602
602
|
return
|
603
603
|
with connection.cursor() as cursor:
|
@@ -618,7 +618,7 @@ class MysqlUpload:
|
|
618
618
|
|
619
619
|
self.config.update({'database': db_name}) # 添加更新 config 字段
|
620
620
|
# connection = pymysql.connect(**self.config) # 重新连接数据库
|
621
|
-
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=
|
621
|
+
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=10)
|
622
622
|
if not connection:
|
623
623
|
return
|
624
624
|
with connection.cursor() as cursor:
|
@@ -964,7 +964,7 @@ class MysqlUpload:
|
|
964
964
|
[dtypes.update({k: inside_v}) for inside_k, inside_v in set_typ.items() if k == inside_k]
|
965
965
|
|
966
966
|
# connection = pymysql.connect(**self.config) # 连接数据库
|
967
|
-
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=
|
967
|
+
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=10)
|
968
968
|
if not connection:
|
969
969
|
return
|
970
970
|
with connection.cursor() as cursor:
|
@@ -985,7 +985,7 @@ class MysqlUpload:
|
|
985
985
|
|
986
986
|
self.config.update({'database': db_name}) # 添加更新 config 字段
|
987
987
|
# connection = pymysql.connect(**self.config) # 重新连接数据库
|
988
|
-
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=
|
988
|
+
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=10)
|
989
989
|
if not connection:
|
990
990
|
return
|
991
991
|
with connection.cursor() as cursor:
|
@@ -1264,7 +1264,7 @@ class MysqlUpload:
|
|
1264
1264
|
print(f'未指定文件名: filename')
|
1265
1265
|
return
|
1266
1266
|
# connection = pymysql.connect(**self.config) # 连接数据库
|
1267
|
-
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=
|
1267
|
+
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=10)
|
1268
1268
|
if not connection:
|
1269
1269
|
return
|
1270
1270
|
# try:
|
@@ -1276,7 +1276,7 @@ class MysqlUpload:
|
|
1276
1276
|
return
|
1277
1277
|
self.config.update({'database': db_name})
|
1278
1278
|
# connection = pymysql.connect(**self.config) # 重新连接数据库
|
1279
|
-
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=
|
1279
|
+
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=10)
|
1280
1280
|
if not connection:
|
1281
1281
|
return
|
1282
1282
|
with connection.cursor() as cursor:
|
@@ -1308,7 +1308,7 @@ class MysqlUpload:
|
|
1308
1308
|
df = pd.DataFrame()
|
1309
1309
|
|
1310
1310
|
# connection = pymysql.connect(**self.config) # 连接数据库
|
1311
|
-
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=
|
1311
|
+
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=10)
|
1312
1312
|
if not connection:
|
1313
1313
|
return
|
1314
1314
|
try:
|
@@ -1330,7 +1330,7 @@ class MysqlUpload:
|
|
1330
1330
|
# 读取数据
|
1331
1331
|
self.config.update({'database': db_name})
|
1332
1332
|
# connection = pymysql.connect(**self.config) # 重新连接数据库
|
1333
|
-
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=
|
1333
|
+
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=10)
|
1334
1334
|
if not connection:
|
1335
1335
|
return
|
1336
1336
|
try:
|
@@ -1454,7 +1454,7 @@ class OptimizeDatas:
|
|
1454
1454
|
|
1455
1455
|
return wrapper
|
1456
1456
|
|
1457
|
-
def keep_connect(self, _db_name, _config, max_try: int=
|
1457
|
+
def keep_connect(self, _db_name, _config, max_try: int=10):
|
1458
1458
|
attempts = 1
|
1459
1459
|
while attempts <= max_try:
|
1460
1460
|
try:
|
@@ -1463,7 +1463,7 @@ class OptimizeDatas:
|
|
1463
1463
|
except Exception as e:
|
1464
1464
|
print(f'连接失败,正在重试: {attempts}/{max_try} {e}')
|
1465
1465
|
attempts += 1
|
1466
|
-
time.sleep(
|
1466
|
+
time.sleep(30)
|
1467
1467
|
print(f'{_db_name}: 连接失败,重试次数超限,当前设定次数: {max_try}')
|
1468
1468
|
return None
|
1469
1469
|
|
@@ -1514,7 +1514,7 @@ class OptimizeDatas:
|
|
1514
1514
|
# continue
|
1515
1515
|
self.config.update({'database': self.db_name}) # 添加更新 config 字段
|
1516
1516
|
# self.connection = pymysql.connect(**self.config)
|
1517
|
-
self.connection = self.keep_connect(_db_name=self.db_name, _config=self.config, max_try=
|
1517
|
+
self.connection = self.keep_connect(_db_name=self.db_name, _config=self.config, max_try=10)
|
1518
1518
|
if not self.connection:
|
1519
1519
|
return
|
1520
1520
|
with self.connection.cursor() as cursor:
|
@@ -1669,7 +1669,7 @@ class OptimizeDatas:
|
|
1669
1669
|
def database_list(self):
|
1670
1670
|
""" 获取所有数据库 """
|
1671
1671
|
# connection = pymysql.connect(**self.config) # 连接数据库
|
1672
|
-
connection = self.keep_connect(_db_name=self.db_name, _config=self.config, max_try=
|
1672
|
+
connection = self.keep_connect(_db_name=self.db_name, _config=self.config, max_try=10)
|
1673
1673
|
if not connection:
|
1674
1674
|
return
|
1675
1675
|
with connection.cursor() as cursor:
|
@@ -1681,7 +1681,7 @@ class OptimizeDatas:
|
|
1681
1681
|
def table_list(self, db_name):
|
1682
1682
|
""" 获取指定数据库的所有数据表 """
|
1683
1683
|
# connection = pymysql.connect(**self.config) # 连接数据库
|
1684
|
-
connection = self.keep_connect(_db_name=self.db_name, _config=self.config, max_try=
|
1684
|
+
connection = self.keep_connect(_db_name=self.db_name, _config=self.config, max_try=10)
|
1685
1685
|
if not connection:
|
1686
1686
|
return
|
1687
1687
|
try:
|
@@ -1700,7 +1700,7 @@ class OptimizeDatas:
|
|
1700
1700
|
|
1701
1701
|
self.config.update({'database': db_name}) # 添加更新 config 字段
|
1702
1702
|
# connection = pymysql.connect(**self.config) # 重新连接数据库
|
1703
|
-
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=
|
1703
|
+
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=10)
|
1704
1704
|
if not connection:
|
1705
1705
|
return
|
1706
1706
|
with connection.cursor() as cursor:
|
@@ -1715,7 +1715,7 @@ class OptimizeDatas:
|
|
1715
1715
|
"""
|
1716
1716
|
self.config.update({'database': db_name}) # 添加更新 config 字段
|
1717
1717
|
# connection = pymysql.connect(**self.config)
|
1718
|
-
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=
|
1718
|
+
connection = self.keep_connect(_db_name=db_name, _config=self.config, max_try=10)
|
1719
1719
|
if not connection:
|
1720
1720
|
return
|
1721
1721
|
try:
|
@@ -1751,7 +1751,7 @@ class OptimizeDatas:
|
|
1751
1751
|
for key, table_name in table_dict.items():
|
1752
1752
|
self.config.update({'database': self.db_name}) # 添加更新 config 字段
|
1753
1753
|
# self.connection = pymysql.connect(**self.config)
|
1754
|
-
self.connection = self.keep_connect(_db_name=self.db_name, _config=self.config, max_try=
|
1754
|
+
self.connection = self.keep_connect(_db_name=self.db_name, _config=self.config, max_try=10)
|
1755
1755
|
if not self.connection:
|
1756
1756
|
return
|
1757
1757
|
with self.connection.cursor() as cursor:
|
@@ -17,7 +17,7 @@ mdbq/log/mylogger.py,sha256=oaT7Bp-Hb9jZt52seP3ISUuxVcI19s4UiqTeouScBO0,3258
|
|
17
17
|
mdbq/mongo/__init__.py,sha256=SILt7xMtQIQl_m-ik9WLtJSXIVf424iYgCfE_tnQFbw,13
|
18
18
|
mdbq/mongo/mongo.py,sha256=M9DUeUCMPDngkwn9-ui0uTiFrvfNU1kLs22s5SmoNm0,31899
|
19
19
|
mdbq/mysql/__init__.py,sha256=A_DPJyAoEvTSFojiI2e94zP0FKtCkkwKP1kYUCSyQzo,11
|
20
|
-
mdbq/mysql/mysql.py,sha256=
|
20
|
+
mdbq/mysql/mysql.py,sha256=OndnoP1cBDM9h1bR_Uh2waT3yUjlgr05zHIlC7mmxhc,99378
|
21
21
|
mdbq/mysql/recheck_mysql.py,sha256=ppBTfBLgkRWirMVZ31e_ZPULiGPJU7K3PP9G6QBZ3QI,8605
|
22
22
|
mdbq/mysql/s_query.py,sha256=6L5Cp90zq13noZHjzSA5mqms_hD01c8GO1_NfbYDu6w,9252
|
23
23
|
mdbq/mysql/year_month_day.py,sha256=VgewoE2pJxK7ErjfviL_SMTN77ki8GVbTUcao3vFUCE,1523
|
@@ -33,7 +33,7 @@ mdbq/pbix/refresh_all.py,sha256=OBT9EewSZ0aRS9vL_FflVn74d4l2G00wzHiikCC4TC0,5926
|
|
33
33
|
mdbq/pbix/refresh_all_old.py,sha256=_pq3WSQ728GPtEG5pfsZI2uTJhU8D6ra-htIk1JXYzw,7192
|
34
34
|
mdbq/spider/__init__.py,sha256=RBMFXGy_jd1HXZhngB2T2XTvJqki8P_Fr-pBcwijnew,18
|
35
35
|
mdbq/spider/aikucun.py,sha256=zOacjrJ3MvToyuugA68xB-oN6RKj8K3GxMKudnln9EA,22207
|
36
|
-
mdbq-3.3.
|
37
|
-
mdbq-3.3.
|
38
|
-
mdbq-3.3.
|
39
|
-
mdbq-3.3.
|
36
|
+
mdbq-3.3.13.dist-info/METADATA,sha256=E2o0Hjy1Qv0tpfFweHnCPr-S6V_CL0o0I7suvASpjPA,244
|
37
|
+
mdbq-3.3.13.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
38
|
+
mdbq-3.3.13.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
|
39
|
+
mdbq-3.3.13.dist-info/RECORD,,
|
File without changes
|
File without changes
|