ydb-sqlalchemy 0.1.10__tar.gz → 0.1.12__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.
- {ydb_sqlalchemy-0.1.10/ydb_sqlalchemy.egg-info → ydb_sqlalchemy-0.1.12}/PKG-INFO +9 -2
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/README.md +8 -1
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/requirements.txt +1 -1
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/setup.py +1 -1
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/test/test_suite.py +31 -0
- ydb_sqlalchemy-0.1.12/ydb_sqlalchemy/_version.py +1 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy/sqlalchemy/__init__.py +3 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy/sqlalchemy/compiler/base.py +15 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy/sqlalchemy/datetime_types.py +36 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy/sqlalchemy/dbapi_adapter.py +6 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy/sqlalchemy/types.py +1 -1
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12/ydb_sqlalchemy.egg-info}/PKG-INFO +9 -2
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy.egg-info/requires.txt +1 -1
- ydb_sqlalchemy-0.1.10/ydb_sqlalchemy/_version.py +0 -1
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/LICENSE +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/MANIFEST.in +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/pyproject.toml +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/setup.cfg +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/test/__init__.py +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/test/conftest.py +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/test/test_core.py +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/test/test_inspect.py +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/test/test_orm.py +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy/__init__.py +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy/sqlalchemy/compiler/__init__.py +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy/sqlalchemy/compiler/sa14.py +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy/sqlalchemy/compiler/sa20.py +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy/sqlalchemy/dml.py +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy/sqlalchemy/json.py +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy/sqlalchemy/requirements.py +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy/sqlalchemy/test_sqlalchemy.py +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy.egg-info/SOURCES.txt +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy.egg-info/dependency_links.txt +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy.egg-info/entry_points.txt +0 -0
- {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ydb-sqlalchemy
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.12
|
|
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
|
|
|
@@ -2,11 +2,18 @@
|
|
|
2
2
|
---
|
|
3
3
|
[](https://github.com/ydb-platform/ydb-sqlalchemy/blob/main/LICENSE)
|
|
4
4
|
[](https://badge.fury.io/py/ydb-sqlalchemy)
|
|
5
|
+
[](https://ydb-platform.github.io/ydb-sqlalchemy/api/index.html)
|
|
5
6
|
[](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/tests.yml)
|
|
6
7
|
[](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/style.yml)
|
|
7
8
|
|
|
8
9
|
This repository contains YQL dialect for SqlAlchemy 2.0.
|
|
9
10
|
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
**Documentation**: <a href="https://ydb-platform.github.io/ydb-sqlalchemy" target="_blank">https://ydb-platform.github.io/ydb-sqlalchemy</a>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
10
17
|
**Note**: Dialect also works with SqlAlchemy 1.4, but it is not fully tested.
|
|
11
18
|
|
|
12
19
|
|
|
@@ -168,4 +175,4 @@ It is possible to use YDB SA engine with `pandas` fuctions [to_sql()](https://pa
|
|
|
168
175
|
|
|
169
176
|
* `to_sql` is not fully optimized to load huge datasets. It is recommended to use `method="multi"` and avoid setting a very large `chunksize`.
|
|
170
177
|
|
|
171
|
-
* `read_sql` is not fully optimized to load huge datasets and could lead to significant memory consumptions.
|
|
178
|
+
* `read_sql` is not fully optimized to load huge datasets and could lead to significant memory consumptions.
|
|
@@ -13,7 +13,7 @@ with open("requirements.txt") as f:
|
|
|
13
13
|
|
|
14
14
|
setuptools.setup(
|
|
15
15
|
name="ydb-sqlalchemy",
|
|
16
|
-
version="0.1.
|
|
16
|
+
version="0.1.12", # AUTOVERSION
|
|
17
17
|
description="YDB Dialect for SQLAlchemy",
|
|
18
18
|
author="Yandex LLC",
|
|
19
19
|
author_email="ydb@yandex-team.ru",
|
|
@@ -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "0.1.12"
|
|
@@ -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
|
|
@@ -66,7 +66,10 @@ class AdaptedAsyncConnection(AdaptedConnection):
|
|
|
66
66
|
return await_only(self._connection.get_table_names())
|
|
67
67
|
|
|
68
68
|
|
|
69
|
+
# TODO(vgvoleg): Migrate to AsyncAdapt_dbapi_cursor and AsyncAdapt_dbapi_connection
|
|
69
70
|
class AdaptedAsyncCursor:
|
|
71
|
+
_awaitable_cursor_close: bool = False
|
|
72
|
+
|
|
70
73
|
def __init__(self, cursor: AsyncCursor):
|
|
71
74
|
self._cursor = cursor
|
|
72
75
|
|
|
@@ -112,3 +115,6 @@ class AdaptedAsyncCursor:
|
|
|
112
115
|
|
|
113
116
|
def setoutputsizes(self, *args):
|
|
114
117
|
pass
|
|
118
|
+
|
|
119
|
+
async def _async_soft_close(self) -> None:
|
|
120
|
+
pass
|
|
@@ -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.12
|
|
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
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION = "0.1.10"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy/sqlalchemy/compiler/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy/sqlalchemy/test_sqlalchemy.py
RENAMED
|
File without changes
|
|
File without changes
|
{ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.12}/ydb_sqlalchemy.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|