sqlspec 0.12.0__py3-none-any.whl → 0.12.1__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.
Potentially problematic release.
This version of sqlspec might be problematic. Click here for more details.
- sqlspec/adapters/psycopg/config.py +38 -54
- {sqlspec-0.12.0.dist-info → sqlspec-0.12.1.dist-info}/METADATA +1 -1
- {sqlspec-0.12.0.dist-info → sqlspec-0.12.1.dist-info}/RECORD +6 -6
- {sqlspec-0.12.0.dist-info → sqlspec-0.12.1.dist-info}/WHEEL +0 -0
- {sqlspec-0.12.0.dist-info → sqlspec-0.12.1.dist-info}/licenses/LICENSE +0 -0
- {sqlspec-0.12.0.dist-info → sqlspec-0.12.1.dist-info}/licenses/NOTICE +0 -0
|
@@ -606,57 +606,50 @@ class PsycopgAsyncConfig(AsyncDatabaseConfig[PsycopgAsyncConnection, AsyncConnec
|
|
|
606
606
|
|
|
607
607
|
async def _create_pool(self) -> "AsyncConnectionPool":
|
|
608
608
|
"""Create the actual async connection pool."""
|
|
609
|
-
logger.info("Creating async Psycopg connection pool", extra={"adapter": "psycopg"})
|
|
610
609
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
610
|
+
# Get all config (creates a new dict)
|
|
611
|
+
all_config = self.pool_config_dict.copy()
|
|
612
|
+
|
|
613
|
+
# Separate pool-specific parameters that AsyncConnectionPool accepts directly
|
|
614
|
+
pool_params = {
|
|
615
|
+
"min_size": all_config.pop("min_size", 4),
|
|
616
|
+
"max_size": all_config.pop("max_size", None),
|
|
617
|
+
"name": all_config.pop("name", None),
|
|
618
|
+
"timeout": all_config.pop("timeout", 30.0),
|
|
619
|
+
"max_waiting": all_config.pop("max_waiting", 0),
|
|
620
|
+
"max_lifetime": all_config.pop("max_lifetime", 3600.0),
|
|
621
|
+
"max_idle": all_config.pop("max_idle", 600.0),
|
|
622
|
+
"reconnect_timeout": all_config.pop("reconnect_timeout", 300.0),
|
|
623
|
+
"num_workers": all_config.pop("num_workers", 3),
|
|
624
|
+
}
|
|
614
625
|
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
"name": all_config.pop("name", None),
|
|
620
|
-
"timeout": all_config.pop("timeout", 30.0),
|
|
621
|
-
"max_waiting": all_config.pop("max_waiting", 0),
|
|
622
|
-
"max_lifetime": all_config.pop("max_lifetime", 3600.0),
|
|
623
|
-
"max_idle": all_config.pop("max_idle", 600.0),
|
|
624
|
-
"reconnect_timeout": all_config.pop("reconnect_timeout", 300.0),
|
|
625
|
-
"num_workers": all_config.pop("num_workers", 3),
|
|
626
|
-
}
|
|
626
|
+
# Create a configure callback to set row_factory
|
|
627
|
+
async def configure_connection(conn: "PsycopgAsyncConnection") -> None:
|
|
628
|
+
# Set DictRow as the row factory
|
|
629
|
+
conn.row_factory = dict_row
|
|
627
630
|
|
|
628
|
-
|
|
629
|
-
async def configure_connection(conn: "PsycopgAsyncConnection") -> None:
|
|
630
|
-
# Set DictRow as the row factory
|
|
631
|
-
conn.row_factory = dict_row
|
|
631
|
+
pool_params["configure"] = all_config.pop("configure", configure_connection)
|
|
632
632
|
|
|
633
|
-
|
|
633
|
+
# Remove None values from pool_params
|
|
634
|
+
pool_params = {k: v for k, v in pool_params.items() if v is not None}
|
|
634
635
|
|
|
635
|
-
|
|
636
|
-
|
|
636
|
+
# Handle conninfo vs individual connection parameters
|
|
637
|
+
conninfo = all_config.pop("conninfo", None)
|
|
638
|
+
if conninfo:
|
|
639
|
+
# If conninfo is provided, use it directly
|
|
640
|
+
# Don't pass kwargs when using conninfo string
|
|
641
|
+
pool = AsyncConnectionPool(conninfo, open=False, **pool_params)
|
|
642
|
+
else:
|
|
643
|
+
# Otherwise, pass connection parameters via kwargs
|
|
644
|
+
# Remove any non-connection parameters
|
|
645
|
+
# row_factory is already popped out earlier
|
|
646
|
+
all_config.pop("row_factory", None)
|
|
647
|
+
# Remove pool-specific settings that may have been left
|
|
648
|
+
all_config.pop("kwargs", None)
|
|
649
|
+
pool = AsyncConnectionPool("", kwargs=all_config, open=False, **pool_params)
|
|
637
650
|
|
|
638
|
-
|
|
639
|
-
conninfo = all_config.pop("conninfo", None)
|
|
640
|
-
if conninfo:
|
|
641
|
-
# If conninfo is provided, use it directly
|
|
642
|
-
# Don't pass kwargs when using conninfo string
|
|
643
|
-
pool = AsyncConnectionPool(conninfo, **pool_params)
|
|
644
|
-
else:
|
|
645
|
-
# Otherwise, pass connection parameters via kwargs
|
|
646
|
-
# Remove any non-connection parameters
|
|
647
|
-
# row_factory is already popped out earlier
|
|
648
|
-
all_config.pop("row_factory", None)
|
|
649
|
-
# Remove pool-specific settings that may have been left
|
|
650
|
-
all_config.pop("kwargs", None)
|
|
651
|
-
pool = AsyncConnectionPool("", kwargs=all_config, **pool_params)
|
|
651
|
+
await pool.open()
|
|
652
652
|
|
|
653
|
-
await pool.open()
|
|
654
|
-
logger.info("Async Psycopg connection pool created successfully", extra={"adapter": "psycopg"})
|
|
655
|
-
except Exception as e:
|
|
656
|
-
logger.exception(
|
|
657
|
-
"Failed to create async Psycopg connection pool", extra={"adapter": "psycopg", "error": str(e)}
|
|
658
|
-
)
|
|
659
|
-
raise
|
|
660
653
|
return pool
|
|
661
654
|
|
|
662
655
|
async def _close_pool(self) -> None:
|
|
@@ -664,16 +657,7 @@ class PsycopgAsyncConfig(AsyncDatabaseConfig[PsycopgAsyncConnection, AsyncConnec
|
|
|
664
657
|
if not self.pool_instance:
|
|
665
658
|
return
|
|
666
659
|
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
try:
|
|
670
|
-
await self.pool_instance.close()
|
|
671
|
-
logger.info("Async Psycopg connection pool closed successfully", extra={"adapter": "psycopg"})
|
|
672
|
-
except Exception as e:
|
|
673
|
-
logger.exception(
|
|
674
|
-
"Failed to close async Psycopg connection pool", extra={"adapter": "psycopg", "error": str(e)}
|
|
675
|
-
)
|
|
676
|
-
raise
|
|
660
|
+
await self.pool_instance.close()
|
|
677
661
|
|
|
678
662
|
async def create_connection(self) -> "PsycopgAsyncConnection": # pyright: ignore
|
|
679
663
|
"""Create a single async connection (not from pool).
|
|
@@ -35,7 +35,7 @@ sqlspec/adapters/psqlpy/__init__.py,sha256=dp0-96V4SAbNEvOqlJ8PWEyJMYzZGElVoyneZ
|
|
|
35
35
|
sqlspec/adapters/psqlpy/config.py,sha256=NKlHHDjKr5dF4LQprYA5ivJsNy2UXkvYg8B-kXOvvjE,16342
|
|
36
36
|
sqlspec/adapters/psqlpy/driver.py,sha256=xI89mFdkQulcntbH4ALTOOHn5b6_skCgSbjYDUfvyG4,8650
|
|
37
37
|
sqlspec/adapters/psycopg/__init__.py,sha256=ukkCUPrJPyAG78v4rOqcK4WZDs26PeB9Ra9qkFrGJ3E,484
|
|
38
|
-
sqlspec/adapters/psycopg/config.py,sha256=
|
|
38
|
+
sqlspec/adapters/psycopg/config.py,sha256=SC6SfkgaiYIqHRPueZ3-Avq0AEotLD1d2TX-MJw1lzs,26766
|
|
39
39
|
sqlspec/adapters/psycopg/driver.py,sha256=oTdhj5OXx1gtnA0ZIS0Fdvqu8erXhItn1fl0-lRxatI,33474
|
|
40
40
|
sqlspec/adapters/sqlite/__init__.py,sha256=1lYrJ-DojUAOvXMoZRUJNEVyMmYhO41hMJnDWCEeXlw,234
|
|
41
41
|
sqlspec/adapters/sqlite/config.py,sha256=7yHe1eeVGFZvmTdxUPF2XcIiEcgZFUdncuGf_6qG8Xc,6153
|
|
@@ -138,8 +138,8 @@ sqlspec/utils/serializers.py,sha256=TKsRryRcYMnb8Z8MGkYGClIxcYvC8CW7MsrPQTJqEcY,
|
|
|
138
138
|
sqlspec/utils/singleton.py,sha256=KZ7481tlDAxq6gcAlpULVqPLNc9P0XkHOEp7hfWIHcI,1096
|
|
139
139
|
sqlspec/utils/sync_tools.py,sha256=9ZL_7wJks896ZsRGVB4mS8DgIwK3tKmZClvLblEx8q4,8954
|
|
140
140
|
sqlspec/utils/text.py,sha256=Bit0I0nBgETvfumzguOQFiqrqwplqaoTeEfGdLzgPOk,5083
|
|
141
|
-
sqlspec-0.12.
|
|
142
|
-
sqlspec-0.12.
|
|
143
|
-
sqlspec-0.12.
|
|
144
|
-
sqlspec-0.12.
|
|
145
|
-
sqlspec-0.12.
|
|
141
|
+
sqlspec-0.12.1.dist-info/METADATA,sha256=1THQMFzTiowWooK37RMk7UnuMdzuj8g9QzQKhsnE7NU,16663
|
|
142
|
+
sqlspec-0.12.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
143
|
+
sqlspec-0.12.1.dist-info/licenses/LICENSE,sha256=MdujfZ6l5HuLz4mElxlu049itenOR3gnhN1_Nd3nVcM,1078
|
|
144
|
+
sqlspec-0.12.1.dist-info/licenses/NOTICE,sha256=Lyir8ozXWov7CyYS4huVaOCNrtgL17P-bNV-5daLntQ,1634
|
|
145
|
+
sqlspec-0.12.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|