rdxz2-utill 0.0.8__py3-none-any.whl → 0.0.9__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.
Potentially problematic release.
This version of rdxz2-utill might be problematic. Click here for more details.
- {rdxz2_utill-0.0.8.dist-info → rdxz2_utill-0.0.9.dist-info}/METADATA +1 -1
- {rdxz2_utill-0.0.8.dist-info → rdxz2_utill-0.0.9.dist-info}/RECORD +9 -9
- utill/my_bq.py +8 -4
- utill/my_gcs.py +7 -3
- utill/my_mb.py +3 -3
- {rdxz2_utill-0.0.8.dist-info → rdxz2_utill-0.0.9.dist-info}/WHEEL +0 -0
- {rdxz2_utill-0.0.8.dist-info → rdxz2_utill-0.0.9.dist-info}/entry_points.txt +0 -0
- {rdxz2_utill-0.0.8.dist-info → rdxz2_utill-0.0.9.dist-info}/licenses/LICENSE +0 -0
- {rdxz2_utill-0.0.8.dist-info → rdxz2_utill-0.0.9.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
rdxz2_utill-0.0.
|
|
1
|
+
rdxz2_utill-0.0.9.dist-info/licenses/LICENSE,sha256=PF9CUvzP8XFYopEAzrMzSCovF7RdBdscPqJCDC6KjPc,1073
|
|
2
2
|
utill/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
utill/my_bq.py,sha256=
|
|
3
|
+
utill/my_bq.py,sha256=zxmQJUojJCHSZ7fo20ybbwz_cXnbCh9XNw4feKQJcZc,14848
|
|
4
4
|
utill/my_compare.py,sha256=619QbVk3GihWxen95yVnivKHkah8GgPTLGiSkgHxykw,886
|
|
5
5
|
utill/my_const.py,sha256=88dOqn6NPQ5-hfRqdkew5POoAIyO91XXOGvN76oNsdo,251
|
|
6
6
|
utill/my_csv.py,sha256=svgu93R0pP7UW0B58eJMi0vuJnYhqMtafzCsTIk4yUU,2781
|
|
@@ -9,10 +9,10 @@ utill/my_dict.py,sha256=jPaPfdn4WYpm0uIBPiYFinpHhx1jXpFVDJ9npmvxGZQ,391
|
|
|
9
9
|
utill/my_encryption.py,sha256=SCF7PPur39cW4RHidsRhw-9BZP-ymUH-6LZ9nAHJDsY,2105
|
|
10
10
|
utill/my_env.py,sha256=mREys72Ybg2p9p2s7ApOt0s_6F5-qxR8FyYEcSJ8pmU,2093
|
|
11
11
|
utill/my_file.py,sha256=H3QmIOwubQCUMoOuk7jwf6AnqsljWZIuM7OjelyZby4,1865
|
|
12
|
-
utill/my_gcs.py,sha256=
|
|
12
|
+
utill/my_gcs.py,sha256=KUx89rZx2-dq-GV1LbbvbZ79Qr9NznjG1Zipop4hMZE,4216
|
|
13
13
|
utill/my_input.py,sha256=OyKLoutXpwISReltuL_Gw2oojv16tYWJqQpqabBOQx4,350
|
|
14
14
|
utill/my_json.py,sha256=WgW6mavGhfs4h1N5XbhsDnRk2dbh_ttJWdJUj4iWDN4,1473
|
|
15
|
-
utill/my_mb.py,sha256=
|
|
15
|
+
utill/my_mb.py,sha256=TnbeS38zFCz0TwDl5WeJ7dj3ohwPTam9EID7NNgqVqo,14843
|
|
16
16
|
utill/my_pg.py,sha256=ltNPAsrOJurcCQTDZfAdsOXBSnbmxPzu4E-VtMvUxcM,6708
|
|
17
17
|
utill/my_queue.py,sha256=hINP4_yjmboSjHgo1J3CtPm2X9SE3HfczyED3ip7nfk,1930
|
|
18
18
|
utill/my_string.py,sha256=pINYFR1ligTyVZYzV8P_FolCsZQwYE1jaFNTuQ3XS_8,833
|
|
@@ -28,8 +28,8 @@ utill/cmd/_pg.py,sha256=RVxEiSifyIwMDYDM69vt6WSLdVDr1cMzY6r4T2PzNRA,492
|
|
|
28
28
|
utill/cmd/utill.py,sha256=TlHfiwOUcK1m58PrRCjX9sARiPYZUsoTk-KOTCOz1vM,3558
|
|
29
29
|
utill/templates/mb.json,sha256=M46ZHSaSh4rbD_KGUViGr2B2ZV8_PC-O5Evqi35JK5g,59
|
|
30
30
|
utill/templates/pg.json,sha256=LkJt0VV3zcyt7Tpn6gulsoVQgUc-9uImXOStvzu8cdU,271
|
|
31
|
-
rdxz2_utill-0.0.
|
|
32
|
-
rdxz2_utill-0.0.
|
|
33
|
-
rdxz2_utill-0.0.
|
|
34
|
-
rdxz2_utill-0.0.
|
|
35
|
-
rdxz2_utill-0.0.
|
|
31
|
+
rdxz2_utill-0.0.9.dist-info/METADATA,sha256=kcJh1U-xguJncIsRiFaWECm4_FzTF0FrEa8hj_14h6Y,4401
|
|
32
|
+
rdxz2_utill-0.0.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
33
|
+
rdxz2_utill-0.0.9.dist-info/entry_points.txt,sha256=9n5NWz5Wi9jDvYhB_81_4icgT5xABZ-QivHD8ibcafg,47
|
|
34
|
+
rdxz2_utill-0.0.9.dist-info/top_level.txt,sha256=tuAYZoCsr02JYbpZj7I6fl1IIo53v3GG0uoj-_fINVk,6
|
|
35
|
+
rdxz2_utill-0.0.9.dist-info/RECORD,,
|
utill/my_bq.py
CHANGED
|
@@ -58,11 +58,15 @@ class Dtype:
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
class BQ():
|
|
61
|
-
def __init__(self, project: str = None):
|
|
61
|
+
def __init__(self, project: str = None, service_account_filename: str = None):
|
|
62
62
|
self.project = project or envs.GCP_PROJECT_ID
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
if service_account_filename is not None:
|
|
65
|
+
self.client = bigquery.Client.from_service_account_json(service_account_filename)
|
|
66
|
+
else:
|
|
67
|
+
self.client = bigquery.Client(project=self.project)
|
|
68
|
+
|
|
69
|
+
logger.debug(f'BQ client open, project: {self.client.project}')
|
|
66
70
|
|
|
67
71
|
def __enter__(self):
|
|
68
72
|
return self
|
|
@@ -247,7 +251,7 @@ class BQ():
|
|
|
247
251
|
def download_csv(self, query: str, dst_filename: str, combine: bool = True, pre_query: str = None):
|
|
248
252
|
if not dst_filename.endswith('.csv'):
|
|
249
253
|
raise ValueError('Destination filename must ends with .csv!')
|
|
250
|
-
|
|
254
|
+
|
|
251
255
|
dst_filename = os.path.expanduser(dst_filename)
|
|
252
256
|
|
|
253
257
|
dirname = dst_filename.removesuffix('.csv')
|
utill/my_gcs.py
CHANGED
|
@@ -9,16 +9,20 @@ from .my_env import envs
|
|
|
9
9
|
|
|
10
10
|
class GCS:
|
|
11
11
|
|
|
12
|
-
def __init__(self, project: str = None, bucket_name: str = None):
|
|
12
|
+
def __init__(self, project: str = None, service_account_filename: str = None, bucket_name: str = None):
|
|
13
13
|
self.project = project if project is not None else envs.GCP_PROJECT_ID
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
if service_account_filename is not None:
|
|
16
|
+
self.client = storage.Client.from_service_account_json(service_account_filename)
|
|
17
|
+
else:
|
|
18
|
+
self.client = storage.Client(project=self.project)
|
|
15
19
|
|
|
16
20
|
bucket_name_parts = (bucket_name or envs.GCS_BUCKET).split('/')
|
|
17
21
|
self.change_bucket(bucket_name_parts[0])
|
|
18
22
|
self.base_path = '/'.join(bucket_name_parts[1:]) if len(bucket_name_parts) > 1 else None
|
|
19
23
|
not self.base_path or logger.debug(f'Base path: {self.base_path}')
|
|
20
24
|
|
|
21
|
-
logger.debug(f'GCS client open, project: {project
|
|
25
|
+
logger.debug(f'GCS client open, project: {self.client.project}')
|
|
22
26
|
|
|
23
27
|
def __enter__(self):
|
|
24
28
|
return self
|
utill/my_mb.py
CHANGED
|
@@ -21,10 +21,10 @@ def _translate_user_group_ids(user: dict) -> set:
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
class MB:
|
|
24
|
-
def __init__(self,
|
|
25
|
-
config = json.loads(open(
|
|
24
|
+
def __init__(self, config_source: str = MB_FILENAME) -> None:
|
|
25
|
+
config = json.loads(open(config_source, 'r').read())
|
|
26
26
|
|
|
27
|
-
self.base_url =
|
|
27
|
+
self.base_url = config['base_url']
|
|
28
28
|
self.api_key = config['api_key']
|
|
29
29
|
|
|
30
30
|
self._is_user_initialized = False
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|