sqlalchemy-firebird-async 0.2.4__tar.gz → 0.2.5__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.
Files changed (24) hide show
  1. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/PKG-INFO +2 -2
  2. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/pyproject.toml +2 -2
  3. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/src/sqlalchemy_firebird_async/compiler.py +10 -6
  4. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/src/sqlalchemy_firebird_async/fdb.py +26 -4
  5. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/src/sqlalchemy_firebird_async/firebirdsql.py +7 -5
  6. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/.claude/settings.local.json +0 -0
  7. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/.gitignore +0 -0
  8. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/CONTRIBUTING.md +0 -0
  9. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/LICENSE +0 -0
  10. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/README.md +0 -0
  11. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/justfile +0 -0
  12. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/pytest.ini +0 -0
  13. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/src/sqlalchemy_firebird_async/__init__.py +0 -0
  14. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/src/sqlalchemy_firebird_async/firebird_driver.py +0 -0
  15. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/src/sqlalchemy_firebird_async/types.py +0 -0
  16. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/tests/__init__.py +0 -0
  17. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/tests/conftest.py +0 -0
  18. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/tests/requirements.py +0 -0
  19. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/tests/test_basic.py +0 -0
  20. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/tests/test_compliance.py +0 -0
  21. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/tests/test_enum.py +0 -0
  22. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/tests/test_load.py +0 -0
  23. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/tests/test_terminate.py +0 -0
  24. {sqlalchemy_firebird_async-0.2.4 → sqlalchemy_firebird_async-0.2.5}/tests/test_types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlalchemy-firebird-async
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: Asyncio support for Firebird in SQLAlchemy
5
5
  Project-URL: Homepage, https://github.com/attid/sqlalchemy-firebird-async
6
6
  Project-URL: Repository, https://github.com/attid/sqlalchemy-firebird-async
@@ -14,7 +14,7 @@ Classifier: Intended Audience :: Developers
14
14
  Classifier: Programming Language :: Python :: 3
15
15
  Classifier: Topic :: Database
16
16
  Requires-Dist: greenlet!=0.4.17
17
- Requires-Dist: sqlalchemy-firebird<2.2.0,>=2.0.0
17
+ Requires-Dist: sqlalchemy-firebird>=2.0.0
18
18
  Requires-Dist: sqlalchemy>=2.0.0
19
19
  Provides-Extra: all
20
20
  Requires-Dist: fdb>=2.0; extra == 'all'
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "sqlalchemy-firebird-async"
7
- version = "0.2.4"
7
+ version = "0.2.5"
8
8
  description = "Asyncio support for Firebird in SQLAlchemy"
9
9
  readme = "README.md"
10
10
  authors = [
@@ -20,7 +20,7 @@ classifiers = [
20
20
  ]
21
21
  dependencies = [
22
22
  "sqlalchemy>=2.0.0",
23
- "sqlalchemy-firebird>=2.0.0,<2.2.0",
23
+ "sqlalchemy-firebird>=2.0.0",
24
24
  "greenlet!=0.4.17",
25
25
  ]
26
26
 
@@ -31,13 +31,17 @@ class PatchedFBTypeCompiler(FBTypeCompiler):
31
31
  text += f" COLLATE {collation}"
32
32
  return text
33
33
 
34
- # Fix for TypeError: unsupported operand type(s) for +: 'int' and 'str'
35
34
  if not isinstance(name, str):
36
- # Attempt to restore type name from the type object itself
37
- if hasattr(type_, "__visit_name__"):
38
- name = type_.__visit_name__.upper()
39
- else:
40
- name = "VARCHAR"
35
+ name = getattr(type_, "__visit_name__", "VARCHAR").upper()
36
+
37
+ if hasattr(super(), "_render_firebird_string_type"):
38
+ return super()._render_firebird_string_type(
39
+ name,
40
+ length_override,
41
+ getattr(type_, "collation", None),
42
+ getattr(type_, "charset", None),
43
+ )
44
+
41
45
  return super()._render_string_type(type_, name, length_override)
42
46
 
43
47
  def visit_VARCHAR(self, type_, **kw):
@@ -1,6 +1,8 @@
1
1
  import asyncio
2
+ from math import modf
2
3
  from concurrent.futures import ThreadPoolExecutor
3
4
  from functools import partial
5
+ from sqlalchemy import util
4
6
  from sqlalchemy.util.concurrency import await_only
5
7
  from greenlet import getcurrent
6
8
 
@@ -162,8 +164,8 @@ class AsyncDBAPI:
162
164
  return AsyncConnection(sync_conn, loop, executor)
163
165
 
164
166
  from sqlalchemy.pool import AsyncAdaptedQueuePool
167
+ from sqlalchemy_firebird.base import FBDialect
165
168
  from sqlalchemy_firebird.base import FBExecutionContext
166
- import sqlalchemy_firebird.fdb as fdb
167
169
  from .compiler import PatchedFBCompiler, PatchedFBDDLCompiler, PatchedFBTypeCompiler
168
170
  from .types import FBCHARCompat, FBVARCHARCompat
169
171
  from sqlalchemy import String, DateTime, Time, TIMESTAMP, VARCHAR, CHAR
@@ -187,7 +189,7 @@ class AsyncFDBExecutionContext(FBExecutionContext):
187
189
  driver_conn.begin()
188
190
 
189
191
 
190
- class AsyncFDBDialect(fdb.FBDialect_fdb):
192
+ class AsyncFDBDialect(FBDialect):
191
193
  name = "firebird.fdb_async"
192
194
  driver = "fdb_async"
193
195
  is_async = True
@@ -196,12 +198,12 @@ class AsyncFDBDialect(fdb.FBDialect_fdb):
196
198
  statement_compiler = PatchedFBCompiler
197
199
  ddl_compiler = PatchedFBDDLCompiler
198
200
  execution_ctx_cls = AsyncFDBExecutionContext
199
- ischema_names = fdb.FBDialect_fdb.ischema_names.copy()
201
+ ischema_names = FBDialect.ischema_names.copy()
200
202
  ischema_names["TEXT"] = FBCHARCompat
201
203
  ischema_names["VARYING"] = FBVARCHARCompat
202
204
  ischema_names["CSTRING"] = FBVARCHARCompat
203
205
 
204
- colspecs = fdb.FBDialect_fdb.colspecs.copy()
206
+ colspecs = FBDialect.colspecs.copy()
205
207
  colspecs[String] = _FBSafeString
206
208
  colspecs[VARCHAR] = _FBSafeString
207
209
  colspecs[CHAR] = _FBSafeString
@@ -215,6 +217,26 @@ class AsyncFDBDialect(fdb.FBDialect_fdb):
215
217
  self.type_compiler_instance = PatchedFBTypeCompiler(self)
216
218
  self.type_compiler = self.type_compiler_instance
217
219
 
220
+ def create_connect_args(self, url):
221
+ opts = url.translate_connect_args(username="user")
222
+ if opts.get("port"):
223
+ opts["host"] = "%s/%s" % (opts["host"], opts["port"])
224
+ del opts["port"]
225
+ opts.update(url.query)
226
+
227
+ util.coerce_kw_type(opts, "type_conv", int)
228
+
229
+ return ([], opts)
230
+
231
+ def _get_server_version_info(self, connection):
232
+ dbapi_connection = (
233
+ connection.connection.dbapi_connection
234
+ if self.using_sqlalchemy2
235
+ else connection.connection
236
+ )
237
+ minor, major = modf(dbapi_connection.engine_version)
238
+ return (int(major), int(minor * 10))
239
+
218
240
  def dbapi_exception_translation(self, exception, statement, parameters, context):
219
241
  from sqlalchemy import exc
220
242
 
@@ -6,8 +6,8 @@ from greenlet import getcurrent
6
6
 
7
7
  import firebirdsql
8
8
  import firebirdsql.aio as aio
9
- import sqlalchemy_firebird.fdb as fdb
10
- from .compiler import PatchedFBTypeCompiler
9
+ from sqlalchemy_firebird.base import FBDialect
10
+ from .compiler import PatchedFBCompiler, PatchedFBDDLCompiler, PatchedFBTypeCompiler
11
11
  from sqlalchemy import String
12
12
  from .types import _FBSafeString
13
13
 
@@ -134,14 +134,16 @@ class AsyncPyfbDBAPI:
134
134
  return firebirdsql.Binary(value)
135
135
 
136
136
 
137
- class AsyncFirebirdSQLDialect(fdb.FBDialect_fdb):
137
+ class AsyncFirebirdSQLDialect(FBDialect):
138
138
  name = "firebird.firebirdsql_async"
139
139
  driver = "firebirdsql_async"
140
140
  is_async = True
141
141
  supports_statement_cache = False
142
142
  poolclass = AsyncAdaptedQueuePool
143
+ statement_compiler = PatchedFBCompiler
144
+ ddl_compiler = PatchedFBDDLCompiler
143
145
 
144
- colspecs = fdb.FBDialect_fdb.colspecs.copy()
146
+ colspecs = FBDialect.colspecs.copy()
145
147
  colspecs[String] = _FBSafeString
146
148
 
147
149
  def __init__(self, *args, **kwargs):
@@ -192,4 +194,4 @@ class AsyncFirebirdSQLDialect(fdb.FBDialect_fdb):
192
194
  minor = int(parts[1]) if len(parts) > 1 else 0
193
195
  return (major, minor)
194
196
  except (ValueError, IndexError):
195
- return (0, 0)
197
+ return (0, 0)