latch-postgres 0.1.12__tar.gz → 0.1.14__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.
- {latch_postgres-0.1.12 → latch_postgres-0.1.14}/PKG-INFO +1 -1
- {latch_postgres-0.1.12 → latch_postgres-0.1.14}/latch_postgres/postgres.py +12 -2
- {latch_postgres-0.1.12 → latch_postgres-0.1.14}/pyproject.toml +1 -1
- {latch_postgres-0.1.12 → latch_postgres-0.1.14}/setup.py +1 -1
- {latch_postgres-0.1.12 → latch_postgres-0.1.14}/LICENSE +0 -0
- {latch_postgres-0.1.12 → latch_postgres-0.1.14}/README.md +0 -0
- {latch_postgres-0.1.12 → latch_postgres-0.1.14}/latch_postgres/__init__.py +0 -0
- {latch_postgres-0.1.12 → latch_postgres-0.1.14}/latch_postgres/py.typed +0 -0
- {latch_postgres-0.1.12 → latch_postgres-0.1.14}/latch_postgres/retries.py +0 -0
|
@@ -55,7 +55,7 @@ from psycopg.errors import (
|
|
|
55
55
|
TooManyConnections,
|
|
56
56
|
UndefinedFile,
|
|
57
57
|
)
|
|
58
|
-
from psycopg.rows import AsyncRowFactory, Row, kwargs_row
|
|
58
|
+
from psycopg.rows import AsyncRowFactory, Row, dict_row, kwargs_row
|
|
59
59
|
from psycopg.types.composite import CompositeInfo, register_composite
|
|
60
60
|
from psycopg.types.enum import EnumInfo, register_enum
|
|
61
61
|
from psycopg_pool import AsyncConnectionPool
|
|
@@ -184,6 +184,15 @@ class LatchAsyncConnection(AsyncConnection[Row]):
|
|
|
184
184
|
|
|
185
185
|
yield curs
|
|
186
186
|
|
|
187
|
+
@asynccontextmanager
|
|
188
|
+
async def _query_no_validate(
|
|
189
|
+
self, query: sql.SQL, **kwargs: Any
|
|
190
|
+
) -> AsyncGenerator[AsyncCursor[Any], None]:
|
|
191
|
+
async with self.cursor(dict_row) as curs:
|
|
192
|
+
await curs.execute(query, params=kwargs)
|
|
193
|
+
|
|
194
|
+
yield curs
|
|
195
|
+
|
|
187
196
|
async def queryn(self, model: type[T], query: sql.SQL, **kwargs: Any) -> list[T]:
|
|
188
197
|
async with self._query(model, query, **kwargs) as curs:
|
|
189
198
|
if curs.description is None:
|
|
@@ -219,7 +228,7 @@ class LatchAsyncConnection(AsyncConnection[Row]):
|
|
|
219
228
|
await self.queryn(type(None), query, **kwargs)
|
|
220
229
|
|
|
221
230
|
async def query_unknown(self, query: sql.SQL, **kwargs: Any) -> Any:
|
|
222
|
-
async with self.
|
|
231
|
+
async with self._query_no_validate(query, **kwargs) as curs:
|
|
223
232
|
if curs.description is None:
|
|
224
233
|
return None
|
|
225
234
|
|
|
@@ -529,6 +538,7 @@ def with_conn_retry(
|
|
|
529
538
|
"db.retry.reason",
|
|
530
539
|
),
|
|
531
540
|
)
|
|
541
|
+
await conn.rollback()
|
|
532
542
|
await asyncio.sleep(delay)
|
|
533
543
|
except (SerializationFailure, DeadlockDetected):
|
|
534
544
|
# todo(maximsmol): should be unnecessary if the list below is precise enough
|
|
@@ -18,7 +18,7 @@ install_requires = \
|
|
|
18
18
|
|
|
19
19
|
setup_kwargs = {
|
|
20
20
|
'name': 'latch-postgres',
|
|
21
|
-
'version': '0.1.
|
|
21
|
+
'version': '0.1.14',
|
|
22
22
|
'description': 'Postges wrapper for latch python backend services',
|
|
23
23
|
'long_description': '# python-postgres\n',
|
|
24
24
|
'author': 'Max Smolin',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|