ydb-sqlalchemy 0.1.10__tar.gz → 0.1.11__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 (35) hide show
  1. {ydb_sqlalchemy-0.1.10/ydb_sqlalchemy.egg-info → ydb_sqlalchemy-0.1.11}/PKG-INFO +9 -2
  2. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/README.md +8 -1
  3. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/requirements.txt +1 -1
  4. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/setup.py +1 -1
  5. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/test/test_suite.py +31 -0
  6. ydb_sqlalchemy-0.1.11/ydb_sqlalchemy/_version.py +1 -0
  7. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/ydb_sqlalchemy/sqlalchemy/__init__.py +3 -0
  8. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/ydb_sqlalchemy/sqlalchemy/compiler/base.py +15 -0
  9. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/ydb_sqlalchemy/sqlalchemy/datetime_types.py +36 -0
  10. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/ydb_sqlalchemy/sqlalchemy/types.py +1 -1
  11. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11/ydb_sqlalchemy.egg-info}/PKG-INFO +9 -2
  12. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/ydb_sqlalchemy.egg-info/requires.txt +1 -1
  13. ydb_sqlalchemy-0.1.10/ydb_sqlalchemy/_version.py +0 -1
  14. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/LICENSE +0 -0
  15. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/MANIFEST.in +0 -0
  16. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/pyproject.toml +0 -0
  17. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/setup.cfg +0 -0
  18. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/test/__init__.py +0 -0
  19. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/test/conftest.py +0 -0
  20. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/test/test_core.py +0 -0
  21. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/test/test_inspect.py +0 -0
  22. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/test/test_orm.py +0 -0
  23. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/ydb_sqlalchemy/__init__.py +0 -0
  24. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/ydb_sqlalchemy/sqlalchemy/compiler/__init__.py +0 -0
  25. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/ydb_sqlalchemy/sqlalchemy/compiler/sa14.py +0 -0
  26. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/ydb_sqlalchemy/sqlalchemy/compiler/sa20.py +0 -0
  27. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/ydb_sqlalchemy/sqlalchemy/dbapi_adapter.py +0 -0
  28. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/ydb_sqlalchemy/sqlalchemy/dml.py +0 -0
  29. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/ydb_sqlalchemy/sqlalchemy/json.py +0 -0
  30. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/ydb_sqlalchemy/sqlalchemy/requirements.py +0 -0
  31. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/ydb_sqlalchemy/sqlalchemy/test_sqlalchemy.py +0 -0
  32. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/ydb_sqlalchemy.egg-info/SOURCES.txt +0 -0
  33. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/ydb_sqlalchemy.egg-info/dependency_links.txt +0 -0
  34. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/ydb_sqlalchemy.egg-info/entry_points.txt +0 -0
  35. {ydb_sqlalchemy-0.1.10 → ydb_sqlalchemy-0.1.11}/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.10
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.18.8
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
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ydb-platform/ydb-sqlalchemy/blob/main/LICENSE)
24
24
  [![PyPI version](https://badge.fury.io/py/ydb-sqlalchemy.svg)](https://badge.fury.io/py/ydb-sqlalchemy)
25
+ [![API Reference](https://img.shields.io/badge/API-Reference-lightgreen.svg)](https://ydb-platform.github.io/ydb-sqlalchemy/api/index.html)
25
26
  [![Functional tests](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/tests.yml/badge.svg)](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/tests.yml)
26
27
  [![Style checks](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/style.yml/badge.svg)](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
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ydb-platform/ydb-sqlalchemy/blob/main/LICENSE)
4
4
  [![PyPI version](https://badge.fury.io/py/ydb-sqlalchemy.svg)](https://badge.fury.io/py/ydb-sqlalchemy)
5
+ [![API Reference](https://img.shields.io/badge/API-Reference-lightgreen.svg)](https://ydb-platform.github.io/ydb-sqlalchemy/api/index.html)
5
6
  [![Functional tests](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/tests.yml/badge.svg)](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/tests.yml)
6
7
  [![Style checks](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/style.yml/badge.svg)](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.
@@ -1,3 +1,3 @@
1
1
  sqlalchemy >= 1.4.0, < 3.0.0
2
- ydb >= 3.18.8
2
+ ydb >= 3.21.6
3
3
  ydb-dbapi >= 0.1.10
@@ -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.10", # AUTOVERSION
16
+ version="0.1.11", # 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.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.10
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.18.8
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
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ydb-platform/ydb-sqlalchemy/blob/main/LICENSE)
24
24
  [![PyPI version](https://badge.fury.io/py/ydb-sqlalchemy.svg)](https://badge.fury.io/py/ydb-sqlalchemy)
25
+ [![API Reference](https://img.shields.io/badge/API-Reference-lightgreen.svg)](https://ydb-platform.github.io/ydb-sqlalchemy/api/index.html)
25
26
  [![Functional tests](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/tests.yml/badge.svg)](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/tests.yml)
26
27
  [![Style checks](https://github.com/ydb-platform/ydb-sqlalchemy/actions/workflows/style.yml/badge.svg)](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,5 +1,5 @@
1
1
  sqlalchemy<3.0.0,>=1.4.0
2
- ydb>=3.18.8
2
+ ydb>=3.21.6
3
3
  ydb-dbapi>=0.1.10
4
4
 
5
5
  [yc]
@@ -1 +0,0 @@
1
- VERSION = "0.1.10"
File without changes