ydb-sqlalchemy 0.1.5__py2.py3-none-any.whl → 0.1.7__py2.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.
@@ -1 +1 @@
1
- VERSION = "0.1.5"
1
+ VERSION = "0.1.7"
@@ -1,3 +1,7 @@
1
+ from typing import Union
2
+ import sqlalchemy as sa
3
+ import ydb
4
+
1
5
  from .base import (
2
6
  BaseYqlCompiler,
3
7
  BaseYqlDDLCompiler,
@@ -7,7 +11,23 @@ from .base import (
7
11
 
8
12
 
9
13
  class YqlTypeCompiler(BaseYqlTypeCompiler):
10
- ...
14
+ # We use YDB Double for sa.Float for compatibility with old dialect version
15
+ def visit_FLOAT(self, type_: sa.FLOAT, **kw):
16
+ return "DOUBLE"
17
+
18
+ def get_ydb_type(
19
+ self, type_: sa.types.TypeEngine, is_optional: bool
20
+ ) -> Union[ydb.PrimitiveType, ydb.AbstractTypeBuilder]:
21
+ if isinstance(type_, sa.TypeDecorator):
22
+ type_ = type_.impl
23
+
24
+ if isinstance(type_, sa.Float):
25
+ ydb_type = ydb.PrimitiveType.Double
26
+ if is_optional:
27
+ return ydb.OptionalType(ydb_type)
28
+ return ydb_type
29
+
30
+ return super().get_ydb_type(type_, is_optional)
11
31
 
12
32
 
13
33
  class YqlIdentifierPreparer(BaseYqlIdentifierPreparer):
@@ -87,13 +87,13 @@ class AdaptedAsyncCursor:
87
87
  return self._cursor.rowcount
88
88
 
89
89
  def fetchone(self):
90
- return await_only(self._cursor.fetchone())
90
+ return self._cursor.fetchone()
91
91
 
92
92
  def fetchmany(self, size=None):
93
- return await_only(self._cursor.fetchmany(size=size))
93
+ return self._cursor.fetchmany(size=size)
94
94
 
95
95
  def fetchall(self):
96
- return await_only(self._cursor.fetchall())
96
+ return self._cursor.fetchall()
97
97
 
98
98
  def execute_scheme(self, sql, parameters=None):
99
99
  return await_only(self._cursor.execute_scheme(sql, parameters))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ydb-sqlalchemy
3
- Version: 0.1.5
3
+ Version: 0.1.7
4
4
  Summary: YDB Dialect for SQLAlchemy
5
5
  Home-page: http://github.com/ydb-platform/ydb-sqlalchemy
6
6
  Author: Yandex LLC
@@ -14,7 +14,7 @@ Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
15
  Requires-Dist: sqlalchemy <3.0.0,>=1.4.0
16
16
  Requires-Dist: ydb >=3.18.8
17
- Requires-Dist: ydb-dbapi >=0.1.6
17
+ Requires-Dist: ydb-dbapi >=0.1.8
18
18
  Provides-Extra: yc
19
19
  Requires-Dist: yandexcloud ; extra == 'yc'
20
20
 
@@ -5,10 +5,10 @@ test/test_inspect.py,sha256=c4kc3jc48MCOfllO-ciiYf1vO-HOfuv0xVoXYT1Jxro,1106
5
5
  test/test_orm.py,sha256=jQVVld50zbUwxwgW9ySIWGaNDEOLzHKXjTkdpsG9TpA,1825
6
6
  test/test_suite.py,sha256=ZnN9eQKiHgtNQeojC82LkncKmvRS2yFsUWy9GiKdVn4,18944
7
7
  ydb_sqlalchemy/__init__.py,sha256=hX7Gy-KOiHk7B5-0wj3ZmLjk4YDJnSMHIAqxVGn_PJY,181
8
- ydb_sqlalchemy/_version.py,sha256=JJN_E8LPcrB-9t0_2FLJuTLaoT-Iszj5E4vZ5ai6ktg,18
8
+ ydb_sqlalchemy/_version.py,sha256=vMp4gKTQ4xtMc6mi7otVsoNJFiWh8CU6TdEjpniuiqY,18
9
9
  ydb_sqlalchemy/sqlalchemy/__init__.py,sha256=GXkc4N-margcHMdZc1_xeB748y0SX2gDzgbGQONu1H4,16356
10
10
  ydb_sqlalchemy/sqlalchemy/datetime_types.py,sha256=MlH4YGlNeo0YihHX8ZiSIEkPdyRVL2QWP0wj-uxqzTI,914
11
- ydb_sqlalchemy/sqlalchemy/dbapi_adapter.py,sha256=8y3_cmwcefSk0gNS4oKhJDjTK3xMls3-4VFm5FwRph0,3157
11
+ ydb_sqlalchemy/sqlalchemy/dbapi_adapter.py,sha256=lKB1pXMEOd7exJwOIs1uHJDeVO0JMQmz-4GR76OH2iM,3121
12
12
  ydb_sqlalchemy/sqlalchemy/dml.py,sha256=k_m6PLOAY7dVzG1gsyo2bB3Lp-o3rhzN0oSX_nfkbFU,310
13
13
  ydb_sqlalchemy/sqlalchemy/json.py,sha256=b4ydjlQjBhlhqGP_Sy2uZVKmt__D-9M7-YLGQMdYGME,1043
14
14
  ydb_sqlalchemy/sqlalchemy/requirements.py,sha256=zm6fcLormtk3KHnbtrBvxfkbG9ZyzNan38HrRB6vC3c,2505
@@ -16,11 +16,11 @@ ydb_sqlalchemy/sqlalchemy/test_sqlalchemy.py,sha256=HSNDtmqYXf5aR1hDtzioQV9YzHAL
16
16
  ydb_sqlalchemy/sqlalchemy/types.py,sha256=sTL3VCMs-UvYONZfheYgSVOyPd4udVYOMz4A6BtauUw,1694
17
17
  ydb_sqlalchemy/sqlalchemy/compiler/__init__.py,sha256=QqA6r-_bw1R97nQZy5ZSJN724znXg88l4mi5PpqAOxI,492
18
18
  ydb_sqlalchemy/sqlalchemy/compiler/base.py,sha256=hMPaX0U8P8UwJF2ZV4YFDgdSrXtMHk62zc8QPa7ZIbM,18222
19
- ydb_sqlalchemy/sqlalchemy/compiler/sa14.py,sha256=WMF-gcmFm8pU0k5LJbjraMfWeA7RrwF3YVMScQmtrtU,505
19
+ ydb_sqlalchemy/sqlalchemy/compiler/sa14.py,sha256=LanxAnwOiMnsnrY05B0jpmvGn5NXuOKMcxi_6N3obVM,1186
20
20
  ydb_sqlalchemy/sqlalchemy/compiler/sa20.py,sha256=rvVhe-pq5bOyuW4KMMMAD7JIWMzy355eijymBvuPwKw,3421
21
- ydb_sqlalchemy-0.1.5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
22
- ydb_sqlalchemy-0.1.5.dist-info/METADATA,sha256=-OWjclCBeOmtJYCL6R1NHtzuf2o4kh2qvBS4UtkvhvU,2489
23
- ydb_sqlalchemy-0.1.5.dist-info/WHEEL,sha256=OpXWERl2xLPRHTvd2ZXo_iluPEQd8uSbYkJ53NAER_Y,109
24
- ydb_sqlalchemy-0.1.5.dist-info/entry_points.txt,sha256=iJxbKYuliWNBmL0iIiw8MxvOXrSEz5xe5fuEBqMRwCE,267
25
- ydb_sqlalchemy-0.1.5.dist-info/top_level.txt,sha256=iS69Y1GTAcTok0u0oQdxP-Q5iVgUGI71XBsaEUrWhMg,20
26
- ydb_sqlalchemy-0.1.5.dist-info/RECORD,,
21
+ ydb_sqlalchemy-0.1.7.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
22
+ ydb_sqlalchemy-0.1.7.dist-info/METADATA,sha256=Zmy6ru5b-FiSU1tJvYvFp72K-laDGWxvlsdpYYBoc0A,2489
23
+ ydb_sqlalchemy-0.1.7.dist-info/WHEEL,sha256=OpXWERl2xLPRHTvd2ZXo_iluPEQd8uSbYkJ53NAER_Y,109
24
+ ydb_sqlalchemy-0.1.7.dist-info/entry_points.txt,sha256=iJxbKYuliWNBmL0iIiw8MxvOXrSEz5xe5fuEBqMRwCE,267
25
+ ydb_sqlalchemy-0.1.7.dist-info/top_level.txt,sha256=iS69Y1GTAcTok0u0oQdxP-Q5iVgUGI71XBsaEUrWhMg,20
26
+ ydb_sqlalchemy-0.1.7.dist-info/RECORD,,