mdbq 3.3.1__py3-none-any.whl → 3.3.2__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
@@ -98,14 +98,17 @@ class MysqlUpload:
|
|
98
98
|
self.password = password
|
99
99
|
self.host = host
|
100
100
|
self.port = port
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
101
|
+
if username == '' or password == '' or host == '' or port == 0:
|
102
|
+
self.config = None
|
103
|
+
else:
|
104
|
+
self.config = {
|
105
|
+
'host': self.host,
|
106
|
+
'port': int(self.port),
|
107
|
+
'user': self.username,
|
108
|
+
'password': self.password,
|
109
|
+
'charset': charset, # utf8mb4 支持存储四字节的UTF-8字符集
|
110
|
+
'cursorclass': pymysql.cursors.DictCursor,
|
111
|
+
}
|
109
112
|
self.filename = None
|
110
113
|
|
111
114
|
@staticmethod
|
@@ -192,6 +195,8 @@ class MysqlUpload:
|
|
192
195
|
filename:
|
193
196
|
reset_id:
|
194
197
|
"""
|
198
|
+
if not self.config:
|
199
|
+
return
|
195
200
|
if '数据主体' not in dict_data.keys():
|
196
201
|
print(f'dict_data 中"数据主体"键不能为空')
|
197
202
|
return
|
@@ -320,7 +325,6 @@ class MysqlUpload:
|
|
320
325
|
connection.rollback()
|
321
326
|
connection.commit()
|
322
327
|
|
323
|
-
|
324
328
|
@try_except
|
325
329
|
def dict_to_mysql(self, db_name, table_name, dict_data, icm_update=None, main_key=None, unique_main_key=None, index_length=100, set_typ=None, allow_not_null=False, cut_data=None):
|
326
330
|
"""
|
@@ -333,6 +337,8 @@ class MysqlUpload:
|
|
333
337
|
set_typ: {}
|
334
338
|
allow_not_null: 创建允许插入空值的列,正常情况下不允许空值
|
335
339
|
"""
|
340
|
+
if not self.config:
|
341
|
+
return
|
336
342
|
if icm_update:
|
337
343
|
if main_key or unique_main_key:
|
338
344
|
print(f'icm_update/unique_main_key/unique_main_key 参数不能同时设定')
|
@@ -672,6 +678,8 @@ class MysqlUpload:
|
|
672
678
|
filename: 用来追踪处理进度,传这个参数是方便定位产生错误的文件
|
673
679
|
allow_not_null: 创建允许插入空值的列,正常情况下不允许空值
|
674
680
|
"""
|
681
|
+
if not self.config:
|
682
|
+
return
|
675
683
|
if icm_update:
|
676
684
|
if move_insert or df_sql or drop_duplicates:
|
677
685
|
print(f'icm_update/move_insert/df_sql/drop_duplicates 参数不能同时设定')
|
@@ -26,7 +26,7 @@ mdbq/log/mylogger.py,sha256=oaT7Bp-Hb9jZt52seP3ISUuxVcI19s4UiqTeouScBO0,3258
|
|
26
26
|
mdbq/mongo/__init__.py,sha256=SILt7xMtQIQl_m-ik9WLtJSXIVf424iYgCfE_tnQFbw,13
|
27
27
|
mdbq/mongo/mongo.py,sha256=v9qvrp6p1ZRWuPpbSilqveiE0FEcZF7U5xUPI0RN4xs,31880
|
28
28
|
mdbq/mysql/__init__.py,sha256=A_DPJyAoEvTSFojiI2e94zP0FKtCkkwKP1kYUCSyQzo,11
|
29
|
-
mdbq/mysql/mysql.py,sha256=
|
29
|
+
mdbq/mysql/mysql.py,sha256=dpQWQTq8PpSYFPAHZRNinLuHKfrekSNYbyOxtOD0SwA,82319
|
30
30
|
mdbq/mysql/recheck_mysql.py,sha256=rgTpvDMWYTyEn7UQdlig-pdXDluTgiU8JG6lkMh8DV0,8665
|
31
31
|
mdbq/mysql/s_query.py,sha256=MbIprZ4yJDAZ9AahZPzl7hqS695Vs0P-AJNwAtA_EEc,9287
|
32
32
|
mdbq/mysql/year_month_day.py,sha256=VgewoE2pJxK7ErjfviL_SMTN77ki8GVbTUcao3vFUCE,1523
|
@@ -44,7 +44,7 @@ mdbq/req_post/__init__.py,sha256=jso1oHcy6cJEfa7udS_9uO5X6kZLoPBF8l3wCYmr5dM,18
|
|
44
44
|
mdbq/req_post/req_tb.py,sha256=qg7pet73IgKGmCwxaeUyImJIoeK_pBQT9BBKD7fkBNg,36160
|
45
45
|
mdbq/spider/__init__.py,sha256=RBMFXGy_jd1HXZhngB2T2XTvJqki8P_Fr-pBcwijnew,18
|
46
46
|
mdbq/spider/aikucun.py,sha256=yG0wqvKKqAsx_OQXAy-wAJF_DPITL3r_S-9txb5bnHk,22436
|
47
|
-
mdbq-3.3.
|
48
|
-
mdbq-3.3.
|
49
|
-
mdbq-3.3.
|
50
|
-
mdbq-3.3.
|
47
|
+
mdbq-3.3.2.dist-info/METADATA,sha256=I4qUUWuBiywfwZwIlLGC1fxlIZGmq46nLGLcluAV3kM,243
|
48
|
+
mdbq-3.3.2.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
|
49
|
+
mdbq-3.3.2.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
|
50
|
+
mdbq-3.3.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|