mdbq 1.0.3__tar.gz → 1.0.5__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.0.3 → mdbq-1.0.5}/PKG-INFO +1 -1
  2. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/aggregation/aggregation.py +3 -3
  3. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/aggregation/query_data.py +7 -1
  4. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/mysql/mysql.py +21 -4
  5. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq.egg-info/PKG-INFO +1 -1
  6. {mdbq-1.0.3 → mdbq-1.0.5}/setup.py +1 -1
  7. {mdbq-1.0.3 → mdbq-1.0.5}/README.txt +0 -0
  8. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/__init__.py +0 -0
  9. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/__version__.py +0 -0
  10. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/aggregation/__init__.py +0 -0
  11. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/aggregation/df_types.py +0 -0
  12. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/aggregation/mysql_types.py +0 -0
  13. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/aggregation/optimize_data.py +0 -0
  14. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/bdup/__init__.py +0 -0
  15. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/bdup/bdup.py +0 -0
  16. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/clean/__init__.py +0 -0
  17. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/clean/data_clean.py +0 -0
  18. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/company/__init__.py +0 -0
  19. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/company/copysh.py +0 -0
  20. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/config/__init__.py +0 -0
  21. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/config/get_myconf.py +0 -0
  22. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/config/products.py +0 -0
  23. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/config/set_support.py +0 -0
  24. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/config/update_conf.py +0 -0
  25. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/dataframe/__init__.py +0 -0
  26. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/dataframe/converter.py +0 -0
  27. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/log/__init__.py +0 -0
  28. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/log/mylogger.py +0 -0
  29. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/mongo/__init__.py +0 -0
  30. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/mongo/mongo.py +0 -0
  31. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/mysql/__init__.py +0 -0
  32. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/mysql/data_types_/345/215/263/345/260/206/345/210/240/351/231/244.py" +0 -0
  33. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/mysql/s_query.py +0 -0
  34. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/mysql/year_month_day.py +0 -0
  35. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/other/__init__.py +0 -0
  36. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/other/porxy.py +0 -0
  37. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/other/pov_city.py +0 -0
  38. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/other/ua_sj.py +0 -0
  39. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/pbix/__init__.py +0 -0
  40. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/pbix/pbix_refresh.py +0 -0
  41. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/pbix/refresh_all.py +0 -0
  42. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq/spider/__init__.py +0 -0
  43. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq.egg-info/SOURCES.txt +0 -0
  44. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq.egg-info/dependency_links.txt +0 -0
  45. {mdbq-1.0.3 → mdbq-1.0.5}/mdbq.egg-info/top_level.txt +0 -0
  46. {mdbq-1.0.3 → mdbq-1.0.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdbq
3
- Version: 1.0.3
3
+ Version: 1.0.5
4
4
  Home-page: https://pypi.org/project/mdbsql
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -920,7 +920,7 @@ if __name__ == '__main__':
920
920
  # username, password, host, port = get_myconf.select_config_values(target_service='nas', database='mysql')
921
921
  # print(username, password, host, port)
922
922
  upload(
923
- path='/Users/xigua/数据中心/原始文件2/生意经/地域分布',
924
- db_name = '生意经2',
925
- collection_name = '省份城市分析',
923
+ path='/Users/xigua/数据中心/原始文件2/属性设置/商品素材',
924
+ db_name = '属性设置2',
925
+ collection_name = '商品素材导出',
926
926
  )
@@ -211,7 +211,13 @@ class GroupBy:
211
211
  """
212
212
  self.is_maximize: 是否最大转化数据
213
213
  """
214
-
214
+ if isinstance(df, pd.DataFrame):
215
+ if len(df) == 0:
216
+ print(f' query_data.groupby函数中 {table_name} 传入的 df 数据长度为0')
217
+ return pd.DataFrame()
218
+ else:
219
+ print(f'query_data.groupby函数中 {table_name} 传入的 df 不是 dataframe 结构')
220
+ return pd.DataFrame()
215
221
  if '宝贝主体报表' in table_name:
216
222
  df.rename(columns={
217
223
  '场景名字': '营销场景',
@@ -43,6 +43,13 @@ class MysqlUpload:
43
43
  table_name: 集合/表名称
44
44
  drop_duplicates:仅限于聚合数据使用,其他情况不要设置
45
45
  """
46
+ if isinstance(df, pd.DataFrame):
47
+ if len(df) == 0:
48
+ print(f'{db_name}: {table_name} 传入的 df 数据长度为0')
49
+ return
50
+ else:
51
+ print(f'{db_name}: {table_name} 传入的 df 不是 dataframe 结构')
52
+ return
46
53
  cv = converter.DataFrameConverter()
47
54
  df = cv.convert_df_cols(df=df) # 清理 dataframe 非法值
48
55
 
@@ -640,14 +647,24 @@ def download_datas(table_name, save_path, start_date):
640
647
  df.to_csv(path, index=False, encoding='utf-8_sig', header=True)
641
648
 
642
649
 
650
+ def one_file_to_mysql(file, db_name, table_name):
651
+ username, password, host, port = get_myconf.select_config_values(target_service='home_lx', database='mysql')
652
+
653
+ df = pd.read_csv(file, encoding='utf-8_sig', header=0, na_filter=False)
654
+ m = MysqlUpload(username=username, password=password, host=host, port=port)
655
+ m.df_to_mysql(df=df, db_name=db_name, table_name=table_name)
656
+
657
+
643
658
  if __name__ == '__main__':
644
659
  username, password, host, port = get_myconf.select_config_values(target_service='company', database='mysql')
645
660
  print(username, password, host, port)
646
661
 
647
- df = pd.read_csv('/Users/xigua/Downloads/余额查询.csv', encoding='utf-8_sig', header=0, na_filter=False)
648
- # df = df.to_dict(orient='records')
649
- m = MysqlUpload(username=username, password=password, host=host, port=port)
650
- m.df_to_mysql_new(df=df, db_name='te2- %s t', table_name='测 -sdf @%试 表')
662
+ file = '/Users/xigua/数据中心/原始文件2/属性设置/城市等级.csv'
663
+ one_file_to_mysql(
664
+ file=file,
665
+ db_name='属性设置2',
666
+ table_name='城市等级',
667
+ )
651
668
 
652
669
 
653
670
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdbq
3
- Version: 1.0.3
3
+ Version: 1.0.5
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.0.3',
6
+ version='1.0.5',
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