tracktolib 0.62.0__tar.gz → 0.62.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.
- {tracktolib-0.62.0 → tracktolib-0.62.1}/PKG-INFO +1 -1
- {tracktolib-0.62.0 → tracktolib-0.62.1}/pyproject.toml +2 -2
- {tracktolib-0.62.0 → tracktolib-0.62.1}/tracktolib/pg/query.py +16 -4
- {tracktolib-0.62.0 → tracktolib-0.62.1}/README.md +0 -0
- {tracktolib-0.62.0 → tracktolib-0.62.1}/tracktolib/__init__.py +0 -0
- {tracktolib-0.62.0 → tracktolib-0.62.1}/tracktolib/api.py +0 -0
- {tracktolib-0.62.0 → tracktolib-0.62.1}/tracktolib/http_utils.py +0 -0
- {tracktolib-0.62.0 → tracktolib-0.62.1}/tracktolib/logs.py +0 -0
- {tracktolib-0.62.0 → tracktolib-0.62.1}/tracktolib/pg/__init__.py +0 -0
- {tracktolib-0.62.0 → tracktolib-0.62.1}/tracktolib/pg/utils.py +0 -0
- {tracktolib-0.62.0 → tracktolib-0.62.1}/tracktolib/pg_sync.py +0 -0
- {tracktolib-0.62.0 → tracktolib-0.62.1}/tracktolib/pg_utils.py +0 -0
- {tracktolib-0.62.0 → tracktolib-0.62.1}/tracktolib/s3/__init__.py +0 -0
- {tracktolib-0.62.0 → tracktolib-0.62.1}/tracktolib/s3/minio.py +0 -0
- {tracktolib-0.62.0 → tracktolib-0.62.1}/tracktolib/s3/s3.py +0 -0
- {tracktolib-0.62.0 → tracktolib-0.62.1}/tracktolib/tests.py +0 -0
- {tracktolib-0.62.0 → tracktolib-0.62.1}/tracktolib/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "tracktolib"
|
|
3
|
-
version = "0.62.
|
|
3
|
+
version = "0.62.1"
|
|
4
4
|
authors = [
|
|
5
5
|
{ email = "julien.brayere@tracktor.fr" }
|
|
6
6
|
]
|
|
@@ -91,7 +91,7 @@ pythonPlatform = "Linux"
|
|
|
91
91
|
|
|
92
92
|
[tool.commitizen]
|
|
93
93
|
name = "cz_conventional_commits"
|
|
94
|
-
version = "0.62.
|
|
94
|
+
version = "0.62.1"
|
|
95
95
|
tag_format = "$version"
|
|
96
96
|
version_files = [
|
|
97
97
|
"pyproject.toml:version"
|
|
@@ -225,10 +225,14 @@ def get_update_fields(
|
|
|
225
225
|
|
|
226
226
|
@dataclass
|
|
227
227
|
class PGUpdateQuery(PGQuery):
|
|
228
|
-
"""
|
|
229
|
-
|
|
228
|
+
"""
|
|
229
|
+
Postgresql UPDATE query generator
|
|
230
230
|
"""
|
|
231
231
|
|
|
232
|
+
"""
|
|
233
|
+
Value to start the arguments from:
|
|
234
|
+
For instance, with a value of 10, the first argument will be $11
|
|
235
|
+
"""
|
|
232
236
|
start_from: int | None = None
|
|
233
237
|
"""Keys to use for the WHERE clause. Theses fields will not be updated"""
|
|
234
238
|
where_keys: list[str] | None = None
|
|
@@ -239,6 +243,8 @@ class PGUpdateQuery(PGQuery):
|
|
|
239
243
|
return_keys: bool = False
|
|
240
244
|
"""Values to update using merge (like {}::jsonb || {}::jsonb)"""
|
|
241
245
|
merge_keys: list[str] | None = None
|
|
246
|
+
"""If True, the query is for many items and values will be a list of tuples"""
|
|
247
|
+
is_many: bool = False
|
|
242
248
|
|
|
243
249
|
_update_fields: str | None = field(init=False, default=None)
|
|
244
250
|
_values: list | None = field(init=False, default=None)
|
|
@@ -264,7 +270,7 @@ class PGUpdateQuery(PGQuery):
|
|
|
264
270
|
def values(self):
|
|
265
271
|
if not self._values:
|
|
266
272
|
raise ValueError("No values found")
|
|
267
|
-
if len(self.items) == 1:
|
|
273
|
+
if len(self.items) == 1 and not self.is_many:
|
|
268
274
|
return self._values
|
|
269
275
|
_where_keys = self.where_keys or []
|
|
270
276
|
_keys_not_where = [k for k in self.keys if k not in _where_keys]
|
|
@@ -516,7 +522,13 @@ async def update_many(
|
|
|
516
522
|
query_callback: QueryCallback[PGUpdateQuery] | None = None,
|
|
517
523
|
):
|
|
518
524
|
query = PGUpdateQuery(
|
|
519
|
-
table=table,
|
|
525
|
+
table=table,
|
|
526
|
+
items=items,
|
|
527
|
+
start_from=start_from,
|
|
528
|
+
where_keys=keys,
|
|
529
|
+
where=where,
|
|
530
|
+
merge_keys=merge_keys,
|
|
531
|
+
is_many=True,
|
|
520
532
|
)
|
|
521
533
|
if query_callback is not None:
|
|
522
534
|
query_callback(query)
|
|
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
|