mdbq 0.3.4__tar.gz → 0.3.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 (43) hide show
  1. {mdbq-0.3.4 → mdbq-0.3.5}/PKG-INFO +1 -1
  2. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/company/copysh.py +2 -2
  3. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/config/update_conf.py +51 -17
  4. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/pbix/refresh_all.py +1 -1
  5. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq.egg-info/PKG-INFO +1 -1
  6. {mdbq-0.3.4 → mdbq-0.3.5}/setup.py +1 -1
  7. {mdbq-0.3.4 → mdbq-0.3.5}/README.txt +0 -0
  8. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/__init__.py +0 -0
  9. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/__version__.py +0 -0
  10. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/aggregation/__init__.py +0 -0
  11. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/aggregation/aggregation.py +0 -0
  12. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/aggregation/optimize_data.py +0 -0
  13. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/aggregation/query_data.py +0 -0
  14. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/bdup/__init__.py +0 -0
  15. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/bdup/bdup.py +0 -0
  16. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/clean/__init__.py +0 -0
  17. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/clean/data_clean.py +0 -0
  18. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/company/__init__.py +0 -0
  19. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/config/__init__.py +0 -0
  20. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/config/get_myconf.py +0 -0
  21. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/config/products.py +0 -0
  22. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/dataframe/__init__.py +0 -0
  23. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/dataframe/converter.py +0 -0
  24. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/log/__init__.py +0 -0
  25. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/log/mylogger.py +0 -0
  26. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/mongo/__init__.py +0 -0
  27. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/mongo/mongo.py +0 -0
  28. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/mysql/__init__.py +0 -0
  29. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/mysql/data_types.py +0 -0
  30. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/mysql/mysql.py +0 -0
  31. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/mysql/s_query.py +0 -0
  32. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/mysql/year_month_day.py +0 -0
  33. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/other/__init__.py +0 -0
  34. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/other/porxy.py +0 -0
  35. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/other/pov_city.py +0 -0
  36. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/other/ua_sj.py +0 -0
  37. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/pbix/__init__.py +0 -0
  38. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/pbix/pbix_refresh.py +0 -0
  39. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq/spider/__init__.py +0 -0
  40. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq.egg-info/SOURCES.txt +0 -0
  41. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq.egg-info/dependency_links.txt +0 -0
  42. {mdbq-0.3.4 → mdbq-0.3.5}/mdbq.egg-info/top_level.txt +0 -0
  43. {mdbq-0.3.4 → mdbq-0.3.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdbq
3
- Version: 0.3.4
3
+ Version: 0.3.5
4
4
  Home-page: https://pypi.org/project/mdbsql
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -339,8 +339,8 @@ def main():
339
339
  dp.upload_df(service_databases=[{'company': 'mysql'}])
340
340
 
341
341
  # 此操作用于修改 .copysh_conf 文件,将 ch_record 改为 false (更新完成)
342
- w = update_conf.UpdateConf(filename='.copysh_conf')
343
- w.update_config(option='ch_record', new_value='False')
342
+ w = update_conf.UpdateConf()
343
+ w.update_config(filename='.copysh_conf', option='ch_record', new_value='False')
344
344
  time.sleep(60)
345
345
  op_data(days=3650) # 数据清理和聚合
346
346
 
@@ -4,6 +4,10 @@ import getpass
4
4
  import configparser
5
5
  import os
6
6
  from urllib import parse
7
+ """
8
+ 文件被 copysh.py / all-datas.py 调用, update_config 函数
9
+ 更新完成后修改 conf 中值为 True
10
+ """
7
11
 
8
12
 
9
13
  class UpdateConf:
@@ -11,31 +15,56 @@ class UpdateConf:
11
15
  读取配置文件信息
12
16
  理论上,在本程序的根目录需要有一个文件夹 support/.myconf 配置文件放在其下
13
17
  """
14
- def __init__(self, filename):
18
+ def __init__(self):
15
19
  if platform.system() == 'Darwin':
16
- path = os.path.join('/Users', getpass.getuser(), '数据中心/自动0备份/py/数据更新/support')
20
+ self.path = os.path.join('/Users', getpass.getuser(), '数据中心/自动0备份/py/数据更新/support')
17
21
  elif platform.system() == 'Windows':
18
- path = os.path.join('C:\\同步空间\\BaiduSyncdisk\\自动0备份\\py\\数据更新\\support')
22
+ self.path = os.path.join('C:\\同步空间\\BaiduSyncdisk\\自动0备份\\py\\数据更新\\support')
19
23
  else:
20
- path = os.path.join('/Users', getpass.getuser(), 'support')
21
- self.path = path
22
- self.filename = filename
23
- self.conf_file = os.path.join(self.path, self.filename)
24
+ self.path = os.path.join('/Users', getpass.getuser(), 'support')
25
+ self.section = 'database' # 默认 文件头标记
26
+ self.filename = None
27
+ self.conf_file = None
24
28
  self.config = None
25
- self.section = 'database'
26
29
 
30
+ def read_txt(self, filename, option=None):
31
+ self.filename = filename
32
+ self.conf_file = os.path.join(self.path, self.filename)
33
+ if not os.path.exists(self.conf_file):
34
+ print(f'缺少配置文件: {self.conf_file}')
35
+ return
36
+ with open(self.conf_file, 'r', encoding='utf-8') as f:
37
+ content = f.readlines()
38
+ content = [item.strip() for item in content if not item.strip().startswith('#') and not item.strip().startswith('[')]
39
+ pbix_list = [item for item in content if item]
40
+ return pbix_list # ['推广数据.pbix', '市场数据新.pbix']
27
41
 
28
- def read_conf(self, option, value):
42
+ def read_conf(self, filename, option=None):
43
+ self.filename = filename
44
+ self.conf_file = os.path.join(self.path, self.filename)
29
45
  if not os.path.exists(self.conf_file):
30
- print(f'缺少配置文件')
46
+ print(f'缺少配置文件: {self.conf_file}')
31
47
  return
32
48
  self.config = configparser.ConfigParser()
33
49
  self.config.read(self.conf_file, 'UTF-8')
34
- res = self.config.get('database', option)
35
- print(res)
50
+ if not option:
51
+ results = []
52
+ for option in self.config.options(self.section):
53
+ results.append({option: self.config.get(self.section, option)})
54
+ return results
55
+ else:
56
+ if option not in self.config.options(self.section):
57
+ print(f'不存在的配置项: {option},文件: {self.conf_file}')
58
+ else:
59
+ return self.config.get(self.section, option)
36
60
 
37
- def update_config(self, option, new_value):
38
- """ 更新配置文件 """
61
+ def update_config(self, filename, option, new_value):
62
+ """
63
+ 更新配置文件
64
+ copysh.py / all-datas.py 调用
65
+ """
66
+ self.filename = filename
67
+ self.conf_file = os.path.join(self.path, self.filename)
39
68
  with open(self.conf_file, 'r', encoding='utf-8') as file:
40
69
  lines = file.readlines()
41
70
  config = configparser.ConfigParser(allow_no_value=True) # 读取配置(不包括注释和空白行)
@@ -67,7 +96,12 @@ class UpdateConf:
67
96
  file.write(f"\n[{self.section}]\n{option} = {new_value}\n")
68
97
 
69
98
 
70
- if __name__ == '__main__':
71
- # w = UpdateConf(filename='.copysh_conf')
72
- # w.update_config(option='ch_record', new_value='false')
99
+ def main():
73
100
  pass
101
+
102
+
103
+ if __name__ == '__main__':
104
+ w = UpdateConf()
105
+ # w.update_config(filename='.copysh_conf', option='ch_record', new_value='false')
106
+ res = w.read_txt(filename='tb_list.txt')
107
+ print(res)
@@ -27,7 +27,7 @@ class RefreshAll:
27
27
  return
28
28
  with open(self.pbix_path, 'r', encoding='utf-8') as f:
29
29
  content = f.readlines()
30
- content = [item.strip() for item in content if not item.strip().startswith('#')]
30
+ content = [item.strip() for item in content if not item.strip().startswith('#') and not item.strip().startswith('[')]
31
31
  pbix_list = [item for item in content if item]
32
32
 
33
33
  if not pbix_list:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mdbq
3
- Version: 0.3.4
3
+ Version: 0.3.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='0.3.4',
6
+ version='0.3.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