latch-postgres 0.1.12__py3-none-any.whl → 0.1.14__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.
@@ -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._query(JsonObject, query, **kwargs) as curs:
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: latch-postgres
3
- Version: 0.1.12
3
+ Version: 0.1.14
4
4
  Summary: Postges wrapper for latch python backend services
5
5
  License: CC0 1.0
6
6
  Author: Max Smolin
@@ -0,0 +1,8 @@
1
+ latch_postgres/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ latch_postgres/postgres.py,sha256=ucmGrKx4vlGhg_1XScYbeahBjfsIUvt9xGDfFwITpCY,24379
3
+ latch_postgres/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ latch_postgres/retries.py,sha256=r5yH00fd_6EJNYFXAq3dAljJBphScpoeST-_oMvyj8Q,1308
5
+ latch_postgres-0.1.14.dist-info/LICENSE,sha256=wh3JZu6ITG7ceN-1g404ekupj5JXAw4pnQ_Qr4sJfew,7052
6
+ latch_postgres-0.1.14.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
7
+ latch_postgres-0.1.14.dist-info/METADATA,sha256=qbQ6s5fnRZ0H15rX8ITule8UqTKAo-_fTVcK5yXP6Qc,766
8
+ latch_postgres-0.1.14.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- latch_postgres/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- latch_postgres/postgres.py,sha256=1RVUNNqvw5CFRM6bD47DEThKGdXSkCwxNrjlPAAzZaw,24031
3
- latch_postgres/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- latch_postgres/retries.py,sha256=r5yH00fd_6EJNYFXAq3dAljJBphScpoeST-_oMvyj8Q,1308
5
- latch_postgres-0.1.12.dist-info/LICENSE,sha256=wh3JZu6ITG7ceN-1g404ekupj5JXAw4pnQ_Qr4sJfew,7052
6
- latch_postgres-0.1.12.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
7
- latch_postgres-0.1.12.dist-info/METADATA,sha256=mRRTGlNDI9N5ylZFoI7K__YtoAYVTgx48Le57E83hzs,766
8
- latch_postgres-0.1.12.dist-info/RECORD,,