tracktolib 0.57.0__tar.gz → 0.58.0__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.57.0 → tracktolib-0.58.0}/PKG-INFO +1 -1
- {tracktolib-0.57.0 → tracktolib-0.58.0}/pyproject.toml +2 -2
- {tracktolib-0.57.0 → tracktolib-0.58.0}/tracktolib/pg_sync.py +20 -10
- {tracktolib-0.57.0 → tracktolib-0.58.0}/LICENSE +0 -0
- {tracktolib-0.57.0 → tracktolib-0.58.0}/README.md +0 -0
- {tracktolib-0.57.0 → tracktolib-0.58.0}/tracktolib/__init__.py +0 -0
- {tracktolib-0.57.0 → tracktolib-0.58.0}/tracktolib/api.py +0 -0
- {tracktolib-0.57.0 → tracktolib-0.58.0}/tracktolib/http_utils.py +0 -0
- {tracktolib-0.57.0 → tracktolib-0.58.0}/tracktolib/logs.py +0 -0
- {tracktolib-0.57.0 → tracktolib-0.58.0}/tracktolib/pg/__init__.py +0 -0
- {tracktolib-0.57.0 → tracktolib-0.58.0}/tracktolib/pg/query.py +0 -0
- {tracktolib-0.57.0 → tracktolib-0.58.0}/tracktolib/pg/utils.py +0 -0
- {tracktolib-0.57.0 → tracktolib-0.58.0}/tracktolib/pg_utils.py +0 -0
- {tracktolib-0.57.0 → tracktolib-0.58.0}/tracktolib/s3/__init__.py +0 -0
- {tracktolib-0.57.0 → tracktolib-0.58.0}/tracktolib/s3/minio.py +0 -0
- {tracktolib-0.57.0 → tracktolib-0.58.0}/tracktolib/s3/s3.py +0 -0
- {tracktolib-0.57.0 → tracktolib-0.58.0}/tracktolib/tests.py +0 -0
- {tracktolib-0.57.0 → tracktolib-0.58.0}/tracktolib/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "tracktolib"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.58.0"
|
|
4
4
|
description = "Utility library for python"
|
|
5
5
|
authors = ["Julien Brayere <julien.brayere@tracktor.fr>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -83,7 +83,7 @@ pythonPlatform = "Linux"
|
|
|
83
83
|
|
|
84
84
|
[tool.commitizen]
|
|
85
85
|
name = "cz_conventional_commits"
|
|
86
|
-
version = "0.
|
|
86
|
+
version = "0.58.0"
|
|
87
87
|
tag_format = "$version"
|
|
88
88
|
version_files = [
|
|
89
89
|
"pyproject.toml:version"
|
|
@@ -7,7 +7,7 @@ try:
|
|
|
7
7
|
from psycopg import Connection, Cursor
|
|
8
8
|
from psycopg.abc import Query
|
|
9
9
|
from psycopg.errors import InvalidCatalogName
|
|
10
|
-
from psycopg.rows import dict_row
|
|
10
|
+
from psycopg.rows import dict_row, DictRow, TupleRow
|
|
11
11
|
from psycopg.types.json import Json
|
|
12
12
|
except ImportError:
|
|
13
13
|
raise ImportError('Please install psycopg or tracktolib with "pg-sync" to use this module')
|
|
@@ -103,22 +103,32 @@ def insert_one(
|
|
|
103
103
|
) -> dict: ...
|
|
104
104
|
|
|
105
105
|
|
|
106
|
+
@overload
|
|
106
107
|
def insert_one(
|
|
107
|
-
engine:
|
|
108
|
-
) ->
|
|
108
|
+
engine: Cursor, table: LiteralString, data: Mapping[str, Any], returning: list[LiteralString]
|
|
109
|
+
) -> DictRow | TupleRow | None: ...
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def insert_one(
|
|
113
|
+
engine: Connection | Cursor,
|
|
114
|
+
table: LiteralString,
|
|
115
|
+
data: Mapping[str, Any],
|
|
116
|
+
returning: list[LiteralString] | None = None,
|
|
117
|
+
) -> dict | DictRow | TupleRow | None:
|
|
109
118
|
query, _data = get_insert_data(table, [data])
|
|
110
119
|
_is_returning = False
|
|
111
120
|
if returning:
|
|
112
121
|
query = f"{query} RETURNING {','.join(returning)}"
|
|
113
122
|
_is_returning = True
|
|
114
123
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
resp = cur.fetchone()
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
124
|
+
if isinstance(engine, Connection):
|
|
125
|
+
with engine.cursor(row_factory=dict_row) as cur:
|
|
126
|
+
_ = cur.execute(query, _data[0])
|
|
127
|
+
resp = cur.fetchone() if _is_returning else None
|
|
128
|
+
engine.commit()
|
|
129
|
+
else:
|
|
130
|
+
_ = engine.execute(query, _data[0])
|
|
131
|
+
resp = engine.fetchone() if _is_returning else None
|
|
122
132
|
return resp
|
|
123
133
|
|
|
124
134
|
|
|
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
|