archipy-postgres 5.22.0__tar.gz → 5.24.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.
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: archipy-postgres
3
- Version: 5.22.0
3
+ Version: 5.24.0
4
4
  Summary: ArchiPy postgres adapter.
5
5
  Author-email: Hossein Nejati <hosseinnejati14@gmail.com>
6
6
  License-Expression: Apache-2.0
7
7
  Requires-Python: <4,>=3.14
8
- Requires-Dist: archipy==5.22.0
9
- Requires-Dist: psycopg[binary,pool]>=3.3.6
8
+ Requires-Dist: archipy==5.24.0
9
+ Requires-Dist: psycopg[binary]>=3.3.6
10
10
  Description-Content-Type: text/markdown
11
11
 
12
12
  # archipy-postgres
@@ -1,6 +1,6 @@
1
1
  """PostgreSQL SQLAlchemy session manager implementations."""
2
2
 
3
- from typing import override
3
+ from typing import Any, override
4
4
 
5
5
  from sqlalchemy import URL
6
6
  from sqlalchemy.exc import SQLAlchemyError
@@ -38,6 +38,7 @@ class PostgresSQlAlchemySessionManager(BaseSQLAlchemySessionManager[PostgresSQLA
38
38
  orm_config: PostgreSQL-specific configuration. If None, uses global config.
39
39
  """
40
40
  configs = orm_config or self._default_config()
41
+ self._configs = configs # read by _get_connect_args, which the base initializer calls
41
42
  super().__init__(configs)
42
43
 
43
44
  @override
@@ -58,6 +59,15 @@ class PostgresSQlAlchemySessionManager(BaseSQLAlchemySessionManager[PostgresSQLA
58
59
  """
59
60
  return "postgresql"
60
61
 
62
+ @override
63
+ def _get_connect_args(self) -> dict[str, Any]:
64
+ """Return the psycopg connection arguments.
65
+
66
+ Returns:
67
+ dict[str, Any]: ``connect_timeout`` when configured, otherwise empty (libpq waits indefinitely).
68
+ """
69
+ return {} if self._configs.CONNECT_TIMEOUT is None else {"connect_timeout": self._configs.CONNECT_TIMEOUT}
70
+
61
71
  @override
62
72
  def _create_url(self, configs: PostgresSQLAlchemyConfig) -> URL:
63
73
  """Create a PostgreSQL connection URL.
@@ -112,6 +122,7 @@ class AsyncPostgresSQlAlchemySessionManager(
112
122
  orm_config: PostgreSQL-specific configuration. If None, uses global config.
113
123
  """
114
124
  configs = orm_config or self._default_config()
125
+ self._configs = configs # read by _get_connect_args, which the base initializer calls
115
126
  super().__init__(configs)
116
127
 
117
128
  @override
@@ -132,6 +143,15 @@ class AsyncPostgresSQlAlchemySessionManager(
132
143
  """
133
144
  return "postgresql"
134
145
 
146
+ @override
147
+ def _get_connect_args(self) -> dict[str, Any]:
148
+ """Return the psycopg connection arguments.
149
+
150
+ Returns:
151
+ dict[str, Any]: ``connect_timeout`` when configured, otherwise empty (libpq waits indefinitely).
152
+ """
153
+ return {} if self._configs.CONNECT_TIMEOUT is None else {"connect_timeout": self._configs.CONNECT_TIMEOUT}
154
+
135
155
  @override
136
156
  def _create_url(self, configs: PostgresSQLAlchemyConfig) -> URL:
137
157
  """Create an async PostgreSQL connection URL.
@@ -5,11 +5,11 @@ authors = [
5
5
  { name = "Hossein Nejati", email = "hosseinnejati14@gmail.com" },
6
6
  ]
7
7
  readme = "README.md"
8
- version = "5.22.0" # This version is set on publish flow!
8
+ version = "5.24.0" # This version is set on publish flow!
9
9
  requires-python = ">=3.14,<4"
10
10
  dependencies = [
11
- "archipy==5.22.0", # Pinned to core version on publish flow!
12
- "psycopg[binary,pool]>=3.3.6",
11
+ "archipy==5.24.0", # Pinned to core version on publish flow!
12
+ "psycopg[binary]>=3.3.6",
13
13
  ]
14
14
  license = "Apache-2.0"
15
15