dycw-utilities 0.149.2__py3-none-any.whl → 0.149.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dycw-utilities
3
- Version: 0.149.2
3
+ Version: 0.149.3
4
4
  Author-email: Derek Wan <d.wan@icloud.com>
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
@@ -1,4 +1,4 @@
1
- utilities/__init__.py,sha256=H4_Q2BKrZajf_bk-k0Cucn-DVrh9y1yhmsey0h5gW-Y,60
1
+ utilities/__init__.py,sha256=ulphOQx-t4YRxHrTnJu_ukrj_lBzCm--fMhrhBgMjdo,60
2
2
  utilities/altair.py,sha256=92E2lCdyHY4Zb-vCw6rEJIsWdKipuu-Tu2ab1ufUfAk,9079
3
3
  utilities/asyncio.py,sha256=z0w3fb-U5Ml5YXVaFFPClizXaQmjDO6YgZg-V9QL0VQ,16021
4
4
  utilities/atomicwrites.py,sha256=xcOWenTBRS0oat3kg7Sqe51AohNThMQ2ixPL7QCG8hw,5795
@@ -48,7 +48,7 @@ utilities/pickle.py,sha256=MBT2xZCsv0pH868IXLGKnlcqNx2IRVKYNpRcqiQQqxw,653
48
48
  utilities/platform.py,sha256=Ue9LSxYvg9yUXGKuz5aZoy_qkUEXde-v6B09exgSctU,2813
49
49
  utilities/polars.py,sha256=BgiDryAVOapi41ddfJqN0wYh_sDj8BNEYtPB36LaHdo,71824
50
50
  utilities/polars_ols.py,sha256=Uc9V5kvlWZ5cU93lKZ-cfAKdVFFw81tqwLW9PxtUvMs,5618
51
- utilities/postgres.py,sha256=rMJ2Bp5IzPz365qKy0r80usa7p_3F0bhNjgFDUHA8CY,11847
51
+ utilities/postgres.py,sha256=FKkivJZDz1-S7cBr7QBjsVHnSleDuDGXCthGKJEYf8U,12151
52
52
  utilities/pottery.py,sha256=w2X80PXWwzdHdqSYJP6ESrPNNDP3xzpyuJn-fp-Vt3M,5969
53
53
  utilities/pqdm.py,sha256=BTsYPtbKQWwX-iXF4qCkfPG7DPxIB54J989n83bXrIo,3092
54
54
  utilities/psutil.py,sha256=KUlu4lrUw9Zg1V7ZGetpWpGb9DB8l_SSDWGbANFNCPU,2104
@@ -88,8 +88,8 @@ utilities/zoneinfo.py,sha256=oEH-nL3t4h9uawyZqWDtNtDAl6M-CLpLYGI_nI6DulM,1971
88
88
  utilities/pytest_plugins/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
89
89
  utilities/pytest_plugins/pytest_randomly.py,sha256=NXzCcGKbpgYouz5yehKb4jmxmi2SexKKpgF4M65bi10,414
90
90
  utilities/pytest_plugins/pytest_regressions.py,sha256=Iwhfv_OJH7UCPZCfoh7ugZ2Xjqjil-BBBsOb8sDwiGI,1471
91
- dycw_utilities-0.149.2.dist-info/METADATA,sha256=hmwpFOQnK6Lfw3KEzMnDsAY3Ip9xlmq0touVZaJXGlU,1697
92
- dycw_utilities-0.149.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
93
- dycw_utilities-0.149.2.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
94
- dycw_utilities-0.149.2.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
95
- dycw_utilities-0.149.2.dist-info/RECORD,,
91
+ dycw_utilities-0.149.3.dist-info/METADATA,sha256=7B63ESaF5MEr-Pow0RWZ8N61NxvMAnPFEo6LR2tpNCY,1697
92
+ dycw_utilities-0.149.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
93
+ dycw_utilities-0.149.3.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
94
+ dycw_utilities-0.149.3.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
95
+ dycw_utilities-0.149.3.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.149.2"
3
+ __version__ = "0.149.3"
utilities/postgres.py CHANGED
@@ -34,10 +34,12 @@ async def pg_dump(
34
34
  *,
35
35
  format_: _PGDumpFormat = "plain",
36
36
  jobs: int | None = None,
37
- schemas: MaybeListStr | None = None,
38
- schemas_exc: MaybeListStr | None = None,
39
- tables: MaybeSequence[TableOrORMInstOrClass | str] | None = None,
40
- tables_exc: MaybeSequence[TableOrORMInstOrClass | str] | None = None,
37
+ data_only: bool = False,
38
+ clean: bool = False,
39
+ schema: MaybeListStr | None = None,
40
+ schema_exc: MaybeListStr | None = None,
41
+ table: MaybeSequence[TableOrORMInstOrClass | str] | None = None,
42
+ table_exc: MaybeSequence[TableOrORMInstOrClass | str] | None = None,
41
43
  inserts: bool = False,
42
44
  on_conflict_do_nothing: bool = False,
43
45
  docker: str | None = None,
@@ -52,10 +54,12 @@ async def pg_dump(
52
54
  path,
53
55
  format_=format_,
54
56
  jobs=jobs,
55
- schemas=schemas,
56
- schemas_exc=schemas_exc,
57
- tables=tables,
58
- tables_exc=tables_exc,
57
+ data_only=data_only,
58
+ clean=clean,
59
+ schema=schema,
60
+ schema_exc=schema_exc,
61
+ table=table,
62
+ table_exc=table_exc,
59
63
  inserts=inserts,
60
64
  on_conflict_do_nothing=on_conflict_do_nothing,
61
65
  docker=docker,
@@ -98,10 +102,12 @@ def _build_pg_dump(
98
102
  *,
99
103
  format_: _PGDumpFormat = "plain",
100
104
  jobs: int | None = None,
101
- schemas: MaybeListStr | None = None,
102
- schemas_exc: MaybeListStr | None = None,
103
- tables: MaybeSequence[TableOrORMInstOrClass | str] | None = None,
104
- tables_exc: MaybeSequence[TableOrORMInstOrClass | str] | None = None,
105
+ data_only: bool = False,
106
+ clean: bool = False,
107
+ schema: MaybeListStr | None = None,
108
+ schema_exc: MaybeListStr | None = None,
109
+ table: MaybeSequence[TableOrORMInstOrClass | str] | None = None,
110
+ table_exc: MaybeSequence[TableOrORMInstOrClass | str] | None = None,
105
111
  inserts: bool = False,
106
112
  on_conflict_do_nothing: bool = False,
107
113
  docker: str | None = None,
@@ -117,10 +123,9 @@ def _build_pg_dump(
117
123
  "--verbose",
118
124
  # output options
119
125
  "--large-objects",
120
- "--clean",
126
+ "--create",
121
127
  "--no-owner",
122
128
  "--no-privileges",
123
- "--if-exists",
124
129
  # connection options
125
130
  f"--host={host}",
126
131
  f"--port={port}",
@@ -128,15 +133,19 @@ def _build_pg_dump(
128
133
  ]
129
134
  if (format_ == "directory") and (jobs is not None):
130
135
  parts.append(f"--jobs={jobs}")
131
- if schemas is not None:
132
- parts.extend([f"--schema={s}" for s in always_iterable(schemas)])
133
- if schemas_exc is not None:
134
- parts.extend([f"--exclude-schema={s}" for s in always_iterable(schemas_exc)])
135
- if tables is not None:
136
- parts.extend([f"--table={_get_table_name(t)}" for t in always_iterable(tables)])
137
- if tables_exc is not None:
136
+ if data_only:
137
+ parts.append("--data-only")
138
+ if clean:
139
+ parts.extend(["--clean", "--if-exists"])
140
+ if schema is not None:
141
+ parts.extend([f"--schema={s}" for s in always_iterable(schema)])
142
+ if schema_exc is not None:
143
+ parts.extend([f"--exclude-schema={s}" for s in always_iterable(schema_exc)])
144
+ if table is not None:
145
+ parts.extend([f"--table={_get_table_name(t)}" for t in always_iterable(table)])
146
+ if table_exc is not None:
138
147
  parts.extend([
139
- f"--exclude-table={_get_table_name(t)}" for t in always_iterable(tables_exc)
148
+ f"--exclude-table={_get_table_name(t)}" for t in always_iterable(table_exc)
140
149
  ])
141
150
  if inserts:
142
151
  parts.append("--inserts")
@@ -239,6 +248,7 @@ def _build_pg_restore_or_psql(
239
248
  psql: bool = False,
240
249
  database: str | None = None,
241
250
  data_only: bool = False,
251
+ clean: bool = False,
242
252
  jobs: int | None = None,
243
253
  schemas: MaybeListStr | None = None,
244
254
  schemas_exc: MaybeListStr | None = None,
@@ -253,6 +263,7 @@ def _build_pg_restore_or_psql(
253
263
  path,
254
264
  database=database,
255
265
  data_only=data_only,
266
+ clean=clean,
256
267
  jobs=jobs,
257
268
  schemas=schemas,
258
269
  schemas_exc=schemas_exc,
@@ -268,6 +279,7 @@ def _build_pg_restore(
268
279
  *,
269
280
  database: str | None = None,
270
281
  data_only: bool = False,
282
+ clean: bool = False,
271
283
  jobs: int | None = None,
272
284
  schemas: MaybeListStr | None = None,
273
285
  schemas_exc: MaybeListStr | None = None,
@@ -293,7 +305,7 @@ def _build_pg_restore(
293
305
  ]
294
306
  if data_only:
295
307
  parts.append("--data-only")
296
- else:
308
+ if clean:
297
309
  parts.extend(["--clean", "--if-exists"])
298
310
  if jobs is not None:
299
311
  parts.append(f"--jobs={jobs}")