ydb-sqlalchemy 0.1.10__py2.py3-none-any.whl → 0.1.11__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.
- test/test_suite.py +31 -0
- ydb_sqlalchemy/_version.py +1 -1
- ydb_sqlalchemy/sqlalchemy/__init__.py +3 -0
- ydb_sqlalchemy/sqlalchemy/compiler/base.py +15 -0
- ydb_sqlalchemy/sqlalchemy/datetime_types.py +36 -0
- ydb_sqlalchemy/sqlalchemy/types.py +1 -1
- {ydb_sqlalchemy-0.1.10.dist-info → ydb_sqlalchemy-0.1.11.dist-info}/METADATA +9 -2
- {ydb_sqlalchemy-0.1.10.dist-info → ydb_sqlalchemy-0.1.11.dist-info}/RECORD +12 -12
- {ydb_sqlalchemy-0.1.10.dist-info → ydb_sqlalchemy-0.1.11.dist-info}/LICENSE +0 -0
- {ydb_sqlalchemy-0.1.10.dist-info → ydb_sqlalchemy-0.1.11.dist-info}/WHEEL +0 -0
- {ydb_sqlalchemy-0.1.10.dist-info → ydb_sqlalchemy-0.1.11.dist-info}/entry_points.txt +0 -0
- {ydb_sqlalchemy-0.1.10.dist-info → ydb_sqlalchemy-0.1.11.dist-info}/top_level.txt +0 -0
test/test_suite.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ctypes
|
|
2
|
+
import datetime
|
|
2
3
|
import decimal
|
|
3
4
|
|
|
4
5
|
import pytest
|
|
@@ -424,6 +425,16 @@ class DateTest(_DateTest):
|
|
|
424
425
|
run_dispose_bind = "once"
|
|
425
426
|
|
|
426
427
|
|
|
428
|
+
class Date32Test(_DateTest):
|
|
429
|
+
run_dispose_bind = "once"
|
|
430
|
+
datatype = ydb_sa_types.YqlDate32
|
|
431
|
+
data = datetime.date(1969, 1, 1)
|
|
432
|
+
|
|
433
|
+
@pytest.mark.skip("Default binding for DATE is not compatible with Date32")
|
|
434
|
+
def test_select_direct(self, connection):
|
|
435
|
+
pass
|
|
436
|
+
|
|
437
|
+
|
|
427
438
|
class DateTimeMicrosecondsTest(_DateTimeMicrosecondsTest):
|
|
428
439
|
run_dispose_bind = "once"
|
|
429
440
|
|
|
@@ -432,10 +443,30 @@ class DateTimeTest(_DateTimeTest):
|
|
|
432
443
|
run_dispose_bind = "once"
|
|
433
444
|
|
|
434
445
|
|
|
446
|
+
class DateTime64Test(_DateTimeTest):
|
|
447
|
+
datatype = ydb_sa_types.YqlDateTime64
|
|
448
|
+
data = datetime.datetime(1969, 10, 15, 12, 57, 18)
|
|
449
|
+
run_dispose_bind = "once"
|
|
450
|
+
|
|
451
|
+
@pytest.mark.skip("Default binding for DATETIME is not compatible with DateTime64")
|
|
452
|
+
def test_select_direct(self, connection):
|
|
453
|
+
pass
|
|
454
|
+
|
|
455
|
+
|
|
435
456
|
class TimestampMicrosecondsTest(_TimestampMicrosecondsTest):
|
|
436
457
|
run_dispose_bind = "once"
|
|
437
458
|
|
|
438
459
|
|
|
460
|
+
class Timestamp64MicrosecondsTest(_TimestampMicrosecondsTest):
|
|
461
|
+
run_dispose_bind = "once"
|
|
462
|
+
datatype = ydb_sa_types.YqlTimestamp64
|
|
463
|
+
data = datetime.datetime(1969, 10, 15, 12, 57, 18, 396)
|
|
464
|
+
|
|
465
|
+
@pytest.mark.skip("Default binding for TIMESTAMP is not compatible with Timestamp64")
|
|
466
|
+
def test_select_direct(self, connection):
|
|
467
|
+
pass
|
|
468
|
+
|
|
469
|
+
|
|
439
470
|
@pytest.mark.skip("unsupported Time data type")
|
|
440
471
|
class TimeTest(_TimeTest):
|
|
441
472
|
pass
|
ydb_sqlalchemy/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION = "0.1.
|
|
1
|
+
VERSION = "0.1.11"
|
|
@@ -61,6 +61,9 @@ COLUMN_TYPES = {
|
|
|
61
61
|
ydb.DecimalType: sa.DECIMAL,
|
|
62
62
|
ydb.PrimitiveType.Yson: sa.TEXT,
|
|
63
63
|
ydb.PrimitiveType.Date: sa.DATE,
|
|
64
|
+
ydb.PrimitiveType.Date32: sa.DATE,
|
|
65
|
+
ydb.PrimitiveType.Timestamp64: sa.TIMESTAMP,
|
|
66
|
+
ydb.PrimitiveType.Datetime64: sa.DATETIME,
|
|
64
67
|
ydb.PrimitiveType.Datetime: sa.DATETIME,
|
|
65
68
|
ydb.PrimitiveType.Timestamp: sa.TIMESTAMP,
|
|
66
69
|
ydb.PrimitiveType.Interval: sa.INTEGER,
|
|
@@ -135,6 +135,15 @@ class BaseYqlTypeCompiler(StrSQLTypeCompiler):
|
|
|
135
135
|
def visit_TIMESTAMP(self, type_: sa.TIMESTAMP, **kw):
|
|
136
136
|
return "Timestamp"
|
|
137
137
|
|
|
138
|
+
def visit_date32(self, type_: types.YqlDate32, **kw):
|
|
139
|
+
return "Date32"
|
|
140
|
+
|
|
141
|
+
def visit_timestamp64(self, type_: types.YqlTimestamp64, **kw):
|
|
142
|
+
return "Timestamp64"
|
|
143
|
+
|
|
144
|
+
def visit_datetime64(self, type_: types.YqlDateTime64, **kw):
|
|
145
|
+
return "DateTime64"
|
|
146
|
+
|
|
138
147
|
def visit_list_type(self, type_: types.ListType, **kw):
|
|
139
148
|
inner = self.process(type_.item_type, **kw)
|
|
140
149
|
return f"List<{inner}>"
|
|
@@ -193,6 +202,12 @@ class BaseYqlTypeCompiler(StrSQLTypeCompiler):
|
|
|
193
202
|
elif isinstance(type_, types.YqlJSON.YqlJSONPathType):
|
|
194
203
|
ydb_type = ydb.PrimitiveType.Utf8
|
|
195
204
|
# Json
|
|
205
|
+
elif isinstance(type_, types.YqlDate32):
|
|
206
|
+
ydb_type = ydb.PrimitiveType.Date32
|
|
207
|
+
elif isinstance(type_, types.YqlTimestamp64):
|
|
208
|
+
ydb_type = ydb.PrimitiveType.Timestamp64
|
|
209
|
+
elif isinstance(type_, types.YqlDateTime64):
|
|
210
|
+
ydb_type = ydb.PrimitiveType.Datetime64
|
|
196
211
|
elif isinstance(type_, sa.DATETIME):
|
|
197
212
|
ydb_type = ydb.PrimitiveType.Datetime
|
|
198
213
|
elif isinstance(type_, sa.TIMESTAMP):
|
|
@@ -36,3 +36,39 @@ class YqlDateTime(YqlTimestamp, sqltypes.DATETIME):
|
|
|
36
36
|
return int(value.timestamp())
|
|
37
37
|
|
|
38
38
|
return process
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class YqlDate32(YqlDate):
|
|
42
|
+
__visit_name__ = "date32"
|
|
43
|
+
|
|
44
|
+
def literal_processor(self, dialect):
|
|
45
|
+
parent = super().literal_processor(dialect)
|
|
46
|
+
|
|
47
|
+
def process(value):
|
|
48
|
+
return f"Date32({parent(value)})"
|
|
49
|
+
|
|
50
|
+
return process
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class YqlTimestamp64(YqlTimestamp):
|
|
54
|
+
__visit_name__ = "timestamp64"
|
|
55
|
+
|
|
56
|
+
def literal_processor(self, dialect):
|
|
57
|
+
parent = super().literal_processor(dialect)
|
|
58
|
+
|
|
59
|
+
def process(value):
|
|
60
|
+
return f"Timestamp64({parent(value)})"
|
|
61
|
+
|
|
62
|
+
return process
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class YqlDateTime64(YqlDateTime):
|
|
66
|
+
__visit_name__ = "datetime64"
|
|
67
|
+
|
|
68
|
+
def literal_processor(self, dialect):
|
|
69
|
+
parent = super().literal_processor(dialect)
|
|
70
|
+
|
|
71
|
+
def process(value):
|
|
72
|
+
return f"DateTime64({parent(value)})"
|
|
73
|
+
|
|
74
|
+
return process
|
|
@@ -11,7 +11,7 @@ else:
|
|
|
11
11
|
from sqlalchemy import ARRAY, exc, types
|
|
12
12
|
from sqlalchemy.sql import type_api
|
|
13
13
|
|
|
14
|
-
from .datetime_types import YqlDate, YqlDateTime, YqlTimestamp # noqa: F401
|
|
14
|
+
from .datetime_types import YqlDate, YqlDateTime, YqlTimestamp, YqlDate32, YqlTimestamp64, YqlDateTime64 # noqa: F401
|
|
15
15
|
from .json import YqlJSON # noqa: F401
|
|
16
16
|
|
|
17
17
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ydb-sqlalchemy
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.11
|
|
4
4
|
Summary: YDB Dialect for SQLAlchemy
|
|
5
5
|
Home-page: http://github.com/ydb-platform/ydb-sqlalchemy
|
|
6
6
|
Author: Yandex LLC
|
|
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
15
|
Requires-Dist: sqlalchemy <3.0.0,>=1.4.0
|
|
16
|
-
Requires-Dist: ydb >=3.
|
|
16
|
+
Requires-Dist: ydb >=3.21.6
|
|
17
17
|
Requires-Dist: ydb-dbapi >=0.1.10
|
|
18
18
|
Provides-Extra: yc
|
|
19
19
|
Requires-Dist: yandexcloud ; extra == 'yc'
|
|
@@ -22,11 +22,18 @@ Requires-Dist: yandexcloud ; extra == 'yc'
|
|
|
22
22
|
---
|
|
23
23
|
[](https://github.com/ydb-platform/ydb-sqlalchemy/blob/main/LICENSE)
|
|
24
24
|
[](https://badge.fury.io/py/ydb-sqlalchemy)
|
|
25
|
+
[](https://ydb-platform.github.io/ydb-sqlalchemy/api/index.html)
|
|
25
26
|
[](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/tests.yml)
|
|
26
27
|
[](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/style.yml)
|
|
27
28
|
|
|
28
29
|
This repository contains YQL dialect for SqlAlchemy 2.0.
|
|
29
30
|
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
**Documentation**: <a href="https://ydb-platform.github.io/ydb-sqlalchemy" target="_blank">https://ydb-platform.github.io/ydb-sqlalchemy</a>
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
30
37
|
**Note**: Dialect also works with SqlAlchemy 1.4, but it is not fully tested.
|
|
31
38
|
|
|
32
39
|
|
|
@@ -3,24 +3,24 @@ test/conftest.py,sha256=rhWa0EQB9EwO_wAwxPdK17Qi582DdbBE8p5Gv4180Ds,570
|
|
|
3
3
|
test/test_core.py,sha256=XvPJ0MtWK2gqGytps4YMUpHtJWKlEqN1rQBUpeeelAg,42859
|
|
4
4
|
test/test_inspect.py,sha256=c4kc3jc48MCOfllO-ciiYf1vO-HOfuv0xVoXYT1Jxro,1106
|
|
5
5
|
test/test_orm.py,sha256=jQVVld50zbUwxwgW9ySIWGaNDEOLzHKXjTkdpsG9TpA,1825
|
|
6
|
-
test/test_suite.py,sha256=
|
|
6
|
+
test/test_suite.py,sha256=XIW5kxJNKGK4FKE_nza-379_OFOwhP8zcsXEC0lPqWY,30569
|
|
7
7
|
ydb_sqlalchemy/__init__.py,sha256=hX7Gy-KOiHk7B5-0wj3ZmLjk4YDJnSMHIAqxVGn_PJY,181
|
|
8
|
-
ydb_sqlalchemy/_version.py,sha256=
|
|
9
|
-
ydb_sqlalchemy/sqlalchemy/__init__.py,sha256=
|
|
10
|
-
ydb_sqlalchemy/sqlalchemy/datetime_types.py,sha256=
|
|
8
|
+
ydb_sqlalchemy/_version.py,sha256=ZYmaLdPDGWutBbfaGi2OftPL61_FbKbiiNjA7KrAwGs,19
|
|
9
|
+
ydb_sqlalchemy/sqlalchemy/__init__.py,sha256=YAj29mdu0GEG0Udoo0p5ANmEyH6OsAKz5FZc0qn6FDY,16570
|
|
10
|
+
ydb_sqlalchemy/sqlalchemy/datetime_types.py,sha256=wrI9kpsI_f7Jhbm7Fu0o_S1QoGCLIe6A9jfUwb41aMM,1929
|
|
11
11
|
ydb_sqlalchemy/sqlalchemy/dbapi_adapter.py,sha256=HsO4Vhv2nj_Qowt23mUH-jRuNdWKV3ryKnZG5OFp5m0,3109
|
|
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
|
|
15
15
|
ydb_sqlalchemy/sqlalchemy/test_sqlalchemy.py,sha256=QPRgUPsTOqAf0gzWjidsIhTPVkfOILy4SCSgNb1GE7o,1039
|
|
16
|
-
ydb_sqlalchemy/sqlalchemy/types.py,sha256=
|
|
16
|
+
ydb_sqlalchemy/sqlalchemy/types.py,sha256=BVeC8RSa2nFnI3-Q7XZxCnAolHc_k_kMCfWhUmbi5wo,3823
|
|
17
17
|
ydb_sqlalchemy/sqlalchemy/compiler/__init__.py,sha256=QqA6r-_bw1R97nQZy5ZSJN724znXg88l4mi5PpqAOxI,492
|
|
18
|
-
ydb_sqlalchemy/sqlalchemy/compiler/base.py,sha256=
|
|
18
|
+
ydb_sqlalchemy/sqlalchemy/compiler/base.py,sha256=FKtVDKl33hGLcIKpV0UR2ppQ-X2XJ5oyh10FXw4I2uY,19220
|
|
19
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.
|
|
22
|
-
ydb_sqlalchemy-0.1.
|
|
23
|
-
ydb_sqlalchemy-0.1.
|
|
24
|
-
ydb_sqlalchemy-0.1.
|
|
25
|
-
ydb_sqlalchemy-0.1.
|
|
26
|
-
ydb_sqlalchemy-0.1.
|
|
21
|
+
ydb_sqlalchemy-0.1.11.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
22
|
+
ydb_sqlalchemy-0.1.11.dist-info/METADATA,sha256=wnHV82yNZg1Q5ZRAzHdO6UnOpGRLqOlF-ob2YJPObKM,5395
|
|
23
|
+
ydb_sqlalchemy-0.1.11.dist-info/WHEEL,sha256=Ll72iyqtt6Rbxp-Q7FSafYA1LeRv98X15xcZWRsFEmY,109
|
|
24
|
+
ydb_sqlalchemy-0.1.11.dist-info/entry_points.txt,sha256=iJxbKYuliWNBmL0iIiw8MxvOXrSEz5xe5fuEBqMRwCE,267
|
|
25
|
+
ydb_sqlalchemy-0.1.11.dist-info/top_level.txt,sha256=iS69Y1GTAcTok0u0oQdxP-Q5iVgUGI71XBsaEUrWhMg,20
|
|
26
|
+
ydb_sqlalchemy-0.1.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|