mdbq 1.1.0__tar.gz → 1.1.1__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.
Files changed (46) hide show
  1. {mdbq-1.1.0 → mdbq-1.1.1}/PKG-INFO +1 -1
  2. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/aggregation/query_data.py +1 -0
  3. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/mysql/mysql.py +16 -6
  4. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq.egg-info/PKG-INFO +1 -1
  5. {mdbq-1.1.0 → mdbq-1.1.1}/setup.py +1 -1
  6. {mdbq-1.1.0 → mdbq-1.1.1}/README.txt +0 -0
  7. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/__init__.py +0 -0
  8. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/__version__.py +0 -0
  9. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/aggregation/__init__.py +0 -0
  10. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/aggregation/aggregation.py +0 -0
  11. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/aggregation/df_types.py +0 -0
  12. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/aggregation/mysql_types.py +0 -0
  13. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/aggregation/optimize_data.py +0 -0
  14. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/bdup/__init__.py +0 -0
  15. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/bdup/bdup.py +0 -0
  16. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/clean/__init__.py +0 -0
  17. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/clean/data_clean.py +0 -0
  18. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/company/__init__.py +0 -0
  19. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/company/copysh.py +0 -0
  20. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/config/__init__.py +0 -0
  21. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/config/get_myconf.py +0 -0
  22. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/config/products.py +0 -0
  23. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/config/set_support.py +0 -0
  24. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/config/update_conf.py +0 -0
  25. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/dataframe/__init__.py +0 -0
  26. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/dataframe/converter.py +0 -0
  27. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/log/__init__.py +0 -0
  28. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/log/mylogger.py +0 -0
  29. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/mongo/__init__.py +0 -0
  30. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/mongo/mongo.py +0 -0
  31. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/mysql/__init__.py +0 -0
  32. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/mysql/data_types_/345/215/263/345/260/206/345/210/240/351/231/244.py" +0 -0
  33. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/mysql/s_query.py +0 -0
  34. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/mysql/year_month_day.py +0 -0
  35. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/other/__init__.py +0 -0
  36. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/other/porxy.py +0 -0
  37. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/other/pov_city.py +0 -0
  38. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/other/ua_sj.py +0 -0
  39. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/pbix/__init__.py +0 -0
  40. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/pbix/pbix_refresh.py +0 -0
  41. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/pbix/refresh_all.py +0 -0
  42. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq/spider/__init__.py +0 -0
  43. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq.egg-info/SOURCES.txt +0 -0
  44. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq.egg-info/dependency_links.txt +0 -0
  45. {mdbq-1.1.0 → mdbq-1.1.1}/mdbq.egg-info/top_level.txt +0 -0
  46. {mdbq-1.1.0 → mdbq-1.1.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdbq
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Home-page: https://pypi.org/project/mdbsql
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -373,6 +373,7 @@ class GroupBy:
373
373
  print(f'<{table_name}>: Groupby 类尚未配置,数据为空')
374
374
  return pd.DataFrame({})
375
375
 
376
+ @try_except
376
377
  def performance(self, bb_tg=True):
377
378
  # print(self.data_tgyj)
378
379
  tg, syj, idbm, pic, cost = (
@@ -183,6 +183,18 @@ class MysqlUpload:
183
183
 
184
184
  def convert_dtype_to_sql(self, df, col, dtype):
185
185
  """ 按照以下规则转换DataFrame列的数据类型为 MYSQL 专有的数据类型 """
186
+
187
+ def find_longest_decimal_value(number_list):
188
+ # 取列表中小数位数最长的值
189
+ longest_value = None
190
+ max_decimals = 0
191
+ for num in number_list:
192
+ decimal_places = len(str(num).split('.')[1])
193
+ if decimal_places > max_decimals:
194
+ max_decimals = decimal_places
195
+ longest_value = num
196
+ return longest_value
197
+
186
198
  # 最优先处理 ID 类型, 在 mysql 里面, 有些列数字过长不能存储为 int 类型
187
199
  if 'id' in col or 'ID' in col or 'Id' in col or '摘要' in col or '商家编码' in col or '单号' in col or '款号' in col:
188
200
  return 'mediumtext'
@@ -207,9 +219,9 @@ class MysqlUpload:
207
219
  return 'mediumtext'
208
220
  return 'INT'
209
221
  elif dtype == 'float64':
210
- # step = len(str(max(df[col].tolist()))) # 数字长度包含小数点
211
- int_step = len(str(max(df[col].tolist())).split('.')[0]) # 整数位数长度
212
- f_step = len(str(max(df[col].tolist())).split('.')[1]) # 小数位数长度
222
+ res = find_longest_decimal_value(df[col].tolist()) # 取小数位数最长的值
223
+ int_step = len(str(res).split('.')[0]) # 整数位数长度
224
+ f_step = len(str(res).split('.')[1]) # 小数位数长度
213
225
  if int_step >= 12:
214
226
  return 'mediumtext' # mysql 中不要使用 float 和 double 类型,会影响计算结果
215
227
  elif int_step >= 8 and f_step >= 0:
@@ -689,7 +701,7 @@ if __name__ == '__main__':
689
701
  username, password, host, port = get_myconf.select_config_values(target_service='company', database='mysql')
690
702
  print(username, password, host, port)
691
703
 
692
- file = '/Users/xigua/Downloads/余额查询.csv'
704
+ file = '/Users/xigua/数据中心/原始文件2/京东报表/JD商品明细spu/2024-08/spu_2024-08-18_全部渠道_商品明细.csv'
693
705
  one_file_to_mysql(
694
706
  file=file,
695
707
  db_name='test',
@@ -698,5 +710,3 @@ if __name__ == '__main__':
698
710
  database='mysql'
699
711
  )
700
712
 
701
-
702
-
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdbq
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Home-page: https://pypi.org/project/mdbsql
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -3,7 +3,7 @@
3
3
  from setuptools import setup, find_packages
4
4
 
5
5
  setup(name='mdbq',
6
- version='1.1.0',
6
+ version='1.1.1',
7
7
  author='xigua, ',
8
8
  author_email="2587125111@qq.com",
9
9
  url='https://pypi.org/project/mdbsql',
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
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