latch-postgres 0.1.21__py3-none-any.whl → 0.2.0__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.
@@ -616,9 +616,12 @@ async def reset_conn(
616
616
  # fixme(maximsmol): use autocommit transactions
617
617
  def get_pool(
618
618
  config: PostgresConnectionConfig,
619
+ *,
619
620
  application_name: str,
620
621
  read_only: bool = True,
621
622
  isolation_level: IsolationLevel = IsolationLevel.SERIALIZABLE,
623
+ configure: Callable[[AsyncConnection[object]], Awaitable[None]] | None = None,
624
+ reset: Callable[[AsyncConnection[object]], Awaitable[None]] | None = None,
622
625
  ) -> TracedAsyncConnectionPool:
623
626
  conn_str = make_conninfo(
624
627
  host=config.host,
@@ -628,17 +631,24 @@ def get_pool(
628
631
  password=config.password,
629
632
  application_name=application_name,
630
633
  )
634
+
635
+ async def configure_impl(x: AsyncConnection[object]) -> None:
636
+ await reset_conn(x, read_only=read_only, isolation_level=isolation_level)
637
+ if configure is not None:
638
+ await configure(x)
639
+
640
+ async def reset_impl(x: AsyncConnection[object]) -> None:
641
+ await reset_conn(x, read_only=read_only, isolation_level=isolation_level)
642
+ if reset is not None:
643
+ await reset(x)
644
+
631
645
  return TracedAsyncConnectionPool(
632
646
  conn_str,
633
647
  min_size=1,
634
648
  max_size=config.pool_size,
635
649
  timeout=timedelta(seconds=5) / timedelta(seconds=1),
636
650
  open=False,
637
- configure=functools.partial(
638
- reset_conn, read_only=read_only, isolation_level=isolation_level
639
- ),
640
- reset=functools.partial(
641
- reset_conn, read_only=read_only, isolation_level=isolation_level
642
- ),
651
+ configure=configure_impl,
652
+ reset=reset_impl,
643
653
  connection_class=LatchAsyncConnection,
644
654
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: latch-postgres
3
- Version: 0.1.21
3
+ Version: 0.2.0
4
4
  Summary: Postges wrapper for latch python backend services
5
5
  Author-email: maximsmol <max@latch.bio>
6
6
  License: CC0-1.0
@@ -0,0 +1,8 @@
1
+ latch_postgres/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ latch_postgres/postgres.py,sha256=FKYt0C66xDSOEc63x7z1HuOAylgPcZWGPDNlD2Htbz8,24922
3
+ latch_postgres/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ latch_postgres/retries.py,sha256=r5yH00fd_6EJNYFXAq3dAljJBphScpoeST-_oMvyj8Q,1308
5
+ latch_postgres-0.2.0.dist-info/METADATA,sha256=GFxp7RS1vAyE60rlXgxY9KV0ETD_titcMqK57a-jzWM,606
6
+ latch_postgres-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ latch_postgres-0.2.0.dist-info/licenses/LICENSE,sha256=wh3JZu6ITG7ceN-1g404ekupj5JXAw4pnQ_Qr4sJfew,7052
8
+ latch_postgres-0.2.0.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- latch_postgres/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- latch_postgres/postgres.py,sha256=-TpNtSGe-EKy-hKOhajkriqbYkKvYV3LegDqx3towJ8,24522
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.21.dist-info/METADATA,sha256=12J7_YVLtpW3MbfvEYAxbP2VAK36ZSjHD7a5vTli-jY,607
6
- latch_postgres-0.1.21.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
- latch_postgres-0.1.21.dist-info/licenses/LICENSE,sha256=wh3JZu6ITG7ceN-1g404ekupj5JXAw4pnQ_Qr4sJfew,7052
8
- latch_postgres-0.1.21.dist-info/RECORD,,