sqlalchemy-spanner 1.19.0__tar.gz → 1.20.1__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.
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/PKG-INFO +2 -2
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/README.rst +1 -1
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/google/cloud/sqlalchemy_spanner/__init__.py +6 -2
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py +31 -5
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/google/cloud/sqlalchemy_spanner/version.py +1 -1
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/sqlalchemy_spanner.egg-info/PKG-INFO +2 -2
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/tests/test_suite_14.py +14 -12
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/LICENSE +0 -0
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/google/cloud/sqlalchemy_spanner/_opentelemetry_tracing.py +0 -0
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/google/cloud/sqlalchemy_spanner/dml.py +0 -0
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/google/cloud/sqlalchemy_spanner/provision.py +0 -0
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/google/cloud/sqlalchemy_spanner/requirements.py +0 -0
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/setup.cfg +0 -0
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/setup.py +0 -0
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/sqlalchemy_spanner.egg-info/SOURCES.txt +0 -0
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/sqlalchemy_spanner.egg-info/dependency_links.txt +0 -0
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/sqlalchemy_spanner.egg-info/entry_points.txt +0 -0
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/sqlalchemy_spanner.egg-info/not-zip-safe +0 -0
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/sqlalchemy_spanner.egg-info/requires.txt +0 -0
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/sqlalchemy_spanner.egg-info/top_level.txt +0 -0
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/tests/test_suite_13.py +0 -0
- {sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/tests/test_suite_20.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlalchemy-spanner
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.20.1
|
|
4
4
|
Summary: SQLAlchemy dialect integrated into Cloud Spanner database
|
|
5
5
|
Home-page: https://github.com/cloudspannerecosystem/python-spanner-sqlalchemy
|
|
6
6
|
Author: Google LLC
|
|
@@ -40,7 +40,7 @@ Spanner dialect for SQLAlchemy
|
|
|
40
40
|
Spanner dialect for SQLAlchemy represents an interface API designed to
|
|
41
41
|
make it possible to control Cloud Spanner databases with SQLAlchemy API.
|
|
42
42
|
The dialect is built on top of `the Spanner DB
|
|
43
|
-
API <https://github.com/googleapis/python
|
|
43
|
+
API <https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-spanner/google/cloud/spanner_dbapi>`__,
|
|
44
44
|
which is designed in accordance with
|
|
45
45
|
`PEP-249 <https://www.python.org/dev/peps/pep-0249/>`__.
|
|
46
46
|
|
|
@@ -4,7 +4,7 @@ Spanner dialect for SQLAlchemy
|
|
|
4
4
|
Spanner dialect for SQLAlchemy represents an interface API designed to
|
|
5
5
|
make it possible to control Cloud Spanner databases with SQLAlchemy API.
|
|
6
6
|
The dialect is built on top of `the Spanner DB
|
|
7
|
-
API <https://github.com/googleapis/python
|
|
7
|
+
API <https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-spanner/google/cloud/spanner_dbapi>`__,
|
|
8
8
|
which is designed in accordance with
|
|
9
9
|
`PEP-249 <https://www.python.org/dev/peps/pep-0249/>`__.
|
|
10
10
|
|
{sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/google/cloud/sqlalchemy_spanner/__init__.py
RENAMED
|
@@ -12,7 +12,11 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
-
from .sqlalchemy_spanner import SpannerDialect
|
|
15
|
+
from .sqlalchemy_spanner import MAX_SIZE, SpannerDialect
|
|
16
16
|
from .version import __version__
|
|
17
17
|
|
|
18
|
-
__all__ = (
|
|
18
|
+
__all__ = (
|
|
19
|
+
"MAX_SIZE",
|
|
20
|
+
"SpannerDialect",
|
|
21
|
+
"__version__",
|
|
22
|
+
)
|
|
@@ -120,8 +120,12 @@ _type_map = {
|
|
|
120
120
|
"TIMESTAMP": types.TIMESTAMP,
|
|
121
121
|
"ARRAY": types.ARRAY,
|
|
122
122
|
"JSON": types.JSON,
|
|
123
|
+
"TOKENLIST": types.String,
|
|
123
124
|
}
|
|
124
125
|
|
|
126
|
+
if hasattr(types, "UUID"):
|
|
127
|
+
_type_map["UUID"] = types.UUID
|
|
128
|
+
|
|
125
129
|
|
|
126
130
|
_type_map_inv = {
|
|
127
131
|
types.Boolean: "BOOL",
|
|
@@ -140,6 +144,12 @@ _type_map_inv = {
|
|
|
140
144
|
types.NullType: "INT64",
|
|
141
145
|
}
|
|
142
146
|
|
|
147
|
+
if hasattr(types, "UUID"):
|
|
148
|
+
_type_map_inv[types.UUID] = "UUID"
|
|
149
|
+
|
|
150
|
+
if hasattr(types, "Uuid"):
|
|
151
|
+
_type_map_inv[types.Uuid] = "UUID"
|
|
152
|
+
|
|
143
153
|
_compound_keywords = {
|
|
144
154
|
selectable.CompoundSelect.UNION: "UNION DISTINCT",
|
|
145
155
|
selectable.CompoundSelect.UNION_ALL: "UNION ALL",
|
|
@@ -149,7 +159,10 @@ _compound_keywords = {
|
|
|
149
159
|
selectable.CompoundSelect.INTERSECT_ALL: "INTERSECT ALL",
|
|
150
160
|
}
|
|
151
161
|
|
|
152
|
-
|
|
162
|
+
#: Maximum allowable character/byte length for Cloud Spanner STRING(MAX) and
|
|
163
|
+
#: BYTES(MAX) DDL data types (2.5 MiB = 2,621,440 bytes).
|
|
164
|
+
MAX_SIZE = 2621440
|
|
165
|
+
_max_size = MAX_SIZE
|
|
153
166
|
|
|
154
167
|
|
|
155
168
|
def int_from_size(size_str):
|
|
@@ -161,7 +174,7 @@ def int_from_size(size_str):
|
|
|
161
174
|
Returns:
|
|
162
175
|
int: The column length value.
|
|
163
176
|
"""
|
|
164
|
-
return
|
|
177
|
+
return MAX_SIZE if size_str == "MAX" else int(size_str)
|
|
165
178
|
|
|
166
179
|
|
|
167
180
|
def engine_to_connection(function):
|
|
@@ -426,8 +439,10 @@ class SpannerSQLCompiler(SQLCompiler):
|
|
|
426
439
|
)
|
|
427
440
|
for c in expression._select_iterables(
|
|
428
441
|
filter(
|
|
429
|
-
lambda col:
|
|
430
|
-
"
|
|
442
|
+
lambda col: (
|
|
443
|
+
not col.dialect_options.get("spanner", {}).get(
|
|
444
|
+
"exclude_from_returning", False
|
|
445
|
+
)
|
|
431
446
|
),
|
|
432
447
|
returning_cols,
|
|
433
448
|
)
|
|
@@ -762,6 +777,12 @@ class SpannerTypeCompiler(GenericTypeCompiler):
|
|
|
762
777
|
Maps SQLAlchemy types to Spanner data types.
|
|
763
778
|
"""
|
|
764
779
|
|
|
780
|
+
def visit_uuid(self, type_, **kw):
|
|
781
|
+
if not type_.native_uuid or not self.dialect.supports_native_uuid:
|
|
782
|
+
return self.visit_CHAR(types.CHAR(36), **kw)
|
|
783
|
+
else:
|
|
784
|
+
return self.visit_UUID(type_, **kw)
|
|
785
|
+
|
|
765
786
|
def visit_INTEGER(self, type_, **kw):
|
|
766
787
|
return "INT64"
|
|
767
788
|
|
|
@@ -830,6 +851,7 @@ class SpannerDialect(DefaultDialect):
|
|
|
830
851
|
paramstyle = "format"
|
|
831
852
|
encoding = "utf-8"
|
|
832
853
|
max_identifier_length = 256
|
|
854
|
+
max_size = MAX_SIZE
|
|
833
855
|
_legacy_binary_type_literal_encoding = "utf-8"
|
|
834
856
|
_default_isolation_level = "SERIALIZABLE"
|
|
835
857
|
|
|
@@ -844,6 +866,7 @@ class SpannerDialect(DefaultDialect):
|
|
|
844
866
|
supports_identity_columns = True
|
|
845
867
|
supports_native_boolean = True
|
|
846
868
|
supports_native_decimal = True
|
|
869
|
+
supports_native_uuid = False
|
|
847
870
|
supports_statement_cache = True
|
|
848
871
|
# Spanner uses protos for enums. Creating a column like
|
|
849
872
|
# Column("an_enum", Enum("A", "B", "C")) will result in a String
|
|
@@ -1300,6 +1323,7 @@ class SpannerDialect(DefaultDialect):
|
|
|
1300
1323
|
{table_type_query}
|
|
1301
1324
|
{schema_filter_query}
|
|
1302
1325
|
i.index_type != 'PRIMARY_KEY'
|
|
1326
|
+
AND i.index_type != 'SEARCH'
|
|
1303
1327
|
AND i.spanner_is_managed = FALSE
|
|
1304
1328
|
GROUP BY i.table_catalog, i.table_schema, i.table_name,
|
|
1305
1329
|
i.index_name, i.is_unique
|
|
@@ -1324,7 +1348,9 @@ class SpannerDialect(DefaultDialect):
|
|
|
1324
1348
|
"column_names": row[3],
|
|
1325
1349
|
"unique": row[4],
|
|
1326
1350
|
"column_sorting": {
|
|
1327
|
-
col: order.lower()
|
|
1351
|
+
col: order.lower()
|
|
1352
|
+
for col, order in zip(row[3], row[5] or [])
|
|
1353
|
+
if order
|
|
1328
1354
|
},
|
|
1329
1355
|
"include_columns": include_columns if include_columns else [],
|
|
1330
1356
|
"dialect_options": dialect_options,
|
{sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/sqlalchemy_spanner.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlalchemy-spanner
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.20.1
|
|
4
4
|
Summary: SQLAlchemy dialect integrated into Cloud Spanner database
|
|
5
5
|
Home-page: https://github.com/cloudspannerecosystem/python-spanner-sqlalchemy
|
|
6
6
|
Author: Google LLC
|
|
@@ -40,7 +40,7 @@ Spanner dialect for SQLAlchemy
|
|
|
40
40
|
Spanner dialect for SQLAlchemy represents an interface API designed to
|
|
41
41
|
make it possible to control Cloud Spanner databases with SQLAlchemy API.
|
|
42
42
|
The dialect is built on top of `the Spanner DB
|
|
43
|
-
API <https://github.com/googleapis/python
|
|
43
|
+
API <https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-spanner/google/cloud/spanner_dbapi>`__,
|
|
44
44
|
which is designed in accordance with
|
|
45
45
|
`PEP-249 <https://www.python.org/dev/peps/pep-0249/>`__.
|
|
46
46
|
|
|
@@ -250,7 +250,7 @@ class ComponentReflectionTestExtra(_ComponentReflectionTestExtra):
|
|
|
250
250
|
@testing.requires.table_reflection
|
|
251
251
|
def test_nullable_reflection(self, connection, metadata):
|
|
252
252
|
t = Table(
|
|
253
|
-
"
|
|
253
|
+
"t_nullable_reflection",
|
|
254
254
|
metadata,
|
|
255
255
|
Column("a", Integer, nullable=True),
|
|
256
256
|
Column("b", Integer, nullable=False),
|
|
@@ -260,19 +260,21 @@ class ComponentReflectionTestExtra(_ComponentReflectionTestExtra):
|
|
|
260
260
|
eq_(
|
|
261
261
|
dict(
|
|
262
262
|
(col["name"], col["nullable"])
|
|
263
|
-
for col in inspect(connection).get_columns("
|
|
263
|
+
for col in inspect(connection).get_columns("t_nullable_reflection")
|
|
264
264
|
),
|
|
265
265
|
{"a": True, "b": False},
|
|
266
266
|
)
|
|
267
267
|
|
|
268
268
|
def _type_round_trip(self, connection, metadata, *types):
|
|
269
269
|
t = Table(
|
|
270
|
-
"
|
|
270
|
+
"t_type_round_trip",
|
|
271
|
+
metadata,
|
|
272
|
+
*[Column("t%d" % i, type_) for i, type_ in enumerate(types)],
|
|
271
273
|
)
|
|
272
274
|
t.create(connection)
|
|
273
275
|
connection.connection.commit()
|
|
274
276
|
|
|
275
|
-
return [c["type"] for c in inspect(connection).get_columns("
|
|
277
|
+
return [c["type"] for c in inspect(connection).get_columns("t_type_round_trip")]
|
|
276
278
|
|
|
277
279
|
@testing.requires.table_reflection
|
|
278
280
|
def test_numeric_reflection(self, connection, metadata):
|
|
@@ -1207,7 +1209,7 @@ class EscapingTest(_EscapingTest):
|
|
|
1207
1209
|
Overriding the test to avoid the same failure.
|
|
1208
1210
|
"""
|
|
1209
1211
|
m = self.metadata
|
|
1210
|
-
t = Table("
|
|
1212
|
+
t = Table("t_percent_signs", m, Column("data", String(50)))
|
|
1211
1213
|
t.create(config.db)
|
|
1212
1214
|
with config.db.begin() as conn:
|
|
1213
1215
|
conn.execute(t.insert(), dict(data="some % value"))
|
|
@@ -1551,7 +1553,7 @@ class NumericTest(_NumericTest):
|
|
|
1551
1553
|
@testing.emits_warning(r".*does \*not\* support Decimal objects natively")
|
|
1552
1554
|
def run(type_, input_, output, filter_=None, check_scale=False):
|
|
1553
1555
|
t = Table(
|
|
1554
|
-
"
|
|
1556
|
+
"t_do_numeric",
|
|
1555
1557
|
metadata,
|
|
1556
1558
|
Column("x", type_),
|
|
1557
1559
|
Column("id", Integer, primary_key=True),
|
|
@@ -1574,7 +1576,7 @@ class NumericTest(_NumericTest):
|
|
|
1574
1576
|
return run
|
|
1575
1577
|
|
|
1576
1578
|
@emits_warning(r".*does \*not\* support Decimal objects natively")
|
|
1577
|
-
def test_render_literal_numeric(self,
|
|
1579
|
+
def test_render_literal_numeric(self, literal_round_trip_spanner):
|
|
1578
1580
|
"""
|
|
1579
1581
|
SPANNER OVERRIDE:
|
|
1580
1582
|
|
|
@@ -1583,14 +1585,14 @@ class NumericTest(_NumericTest):
|
|
|
1583
1585
|
following insertions will fail with `Row [] already exists".
|
|
1584
1586
|
Overriding the test to avoid the same failure.
|
|
1585
1587
|
"""
|
|
1586
|
-
|
|
1588
|
+
literal_round_trip_spanner(
|
|
1587
1589
|
Numeric(precision=8, scale=4),
|
|
1588
1590
|
[decimal.Decimal("15.7563")],
|
|
1589
1591
|
[decimal.Decimal("15.7563")],
|
|
1590
1592
|
)
|
|
1591
1593
|
|
|
1592
1594
|
@emits_warning(r".*does \*not\* support Decimal objects natively")
|
|
1593
|
-
def test_render_literal_numeric_asfloat(self,
|
|
1595
|
+
def test_render_literal_numeric_asfloat(self, literal_round_trip_spanner):
|
|
1594
1596
|
"""
|
|
1595
1597
|
SPANNER OVERRIDE:
|
|
1596
1598
|
|
|
@@ -1599,13 +1601,13 @@ class NumericTest(_NumericTest):
|
|
|
1599
1601
|
following insertions will fail with `Row [] already exists".
|
|
1600
1602
|
Overriding the test to avoid the same failure.
|
|
1601
1603
|
"""
|
|
1602
|
-
|
|
1604
|
+
literal_round_trip_spanner(
|
|
1603
1605
|
Numeric(precision=8, scale=4, asdecimal=False),
|
|
1604
1606
|
[decimal.Decimal("15.7563")],
|
|
1605
1607
|
[15.7563],
|
|
1606
1608
|
)
|
|
1607
1609
|
|
|
1608
|
-
def test_render_literal_float(self,
|
|
1610
|
+
def test_render_literal_float(self, literal_round_trip_spanner):
|
|
1609
1611
|
"""
|
|
1610
1612
|
SPANNER OVERRIDE:
|
|
1611
1613
|
|
|
@@ -1614,7 +1616,7 @@ class NumericTest(_NumericTest):
|
|
|
1614
1616
|
following insertions will fail with `Row [] already exists".
|
|
1615
1617
|
Overriding the test to avoid the same failure.
|
|
1616
1618
|
"""
|
|
1617
|
-
|
|
1619
|
+
literal_round_trip_spanner(
|
|
1618
1620
|
Float(4),
|
|
1619
1621
|
[decimal.Decimal("15.7563")],
|
|
1620
1622
|
[15.7563],
|
|
File without changes
|
|
File without changes
|
{sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/google/cloud/sqlalchemy_spanner/dml.py
RENAMED
|
File without changes
|
{sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/google/cloud/sqlalchemy_spanner/provision.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/sqlalchemy_spanner.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/sqlalchemy_spanner.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/sqlalchemy_spanner.egg-info/not-zip-safe
RENAMED
|
File without changes
|
{sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/sqlalchemy_spanner.egg-info/requires.txt
RENAMED
|
File without changes
|
{sqlalchemy_spanner-1.19.0 → sqlalchemy_spanner-1.20.1}/sqlalchemy_spanner.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|