sqlalchemy-spanner 1.18.0__tar.gz → 1.20.0__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 (22) hide show
  1. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/PKG-INFO +3 -3
  2. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/google/cloud/sqlalchemy_spanner/__init__.py +6 -4
  3. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/google/cloud/sqlalchemy_spanner/_opentelemetry_tracing.py +0 -1
  4. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py +51 -41
  5. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/google/cloud/sqlalchemy_spanner/version.py +1 -1
  6. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/setup.py +1 -2
  7. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/sqlalchemy_spanner.egg-info/PKG-INFO +3 -3
  8. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/tests/test_suite_13.py +110 -67
  9. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/tests/test_suite_14.py +151 -86
  10. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/tests/test_suite_20.py +155 -90
  11. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/LICENSE +0 -0
  12. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/README.rst +0 -0
  13. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/google/cloud/sqlalchemy_spanner/dml.py +0 -0
  14. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/google/cloud/sqlalchemy_spanner/provision.py +0 -0
  15. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/google/cloud/sqlalchemy_spanner/requirements.py +1 -1
  16. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/setup.cfg +0 -0
  17. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/sqlalchemy_spanner.egg-info/SOURCES.txt +0 -0
  18. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/sqlalchemy_spanner.egg-info/dependency_links.txt +0 -0
  19. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/sqlalchemy_spanner.egg-info/entry_points.txt +0 -0
  20. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/sqlalchemy_spanner.egg-info/not-zip-safe +0 -0
  21. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/sqlalchemy_spanner.egg-info/requires.txt +0 -0
  22. {sqlalchemy_spanner-1.18.0 → sqlalchemy_spanner-1.20.0}/sqlalchemy_spanner.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlalchemy-spanner
3
- Version: 1.18.0
3
+ Version: 1.20.0
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
@@ -8,13 +8,12 @@ Author-email: googleapis-packages@google.com
8
8
  License: Apache 2.0
9
9
  Classifier: Intended Audience :: Developers
10
10
  Classifier: License :: OSI Approved :: Apache Software License
11
- Classifier: Programming Language :: Python :: 3.8
12
- Classifier: Programming Language :: Python :: 3.9
13
11
  Classifier: Programming Language :: Python :: 3.10
14
12
  Classifier: Programming Language :: Python :: 3.11
15
13
  Classifier: Programming Language :: Python :: 3.12
16
14
  Classifier: Programming Language :: Python :: 3.13
17
15
  Classifier: Programming Language :: Python :: 3.14
16
+ Requires-Python: >=3.10
18
17
  License-File: LICENSE
19
18
  Requires-Dist: sqlalchemy>=1.1.13
20
19
  Requires-Dist: google-cloud-spanner>=3.55.0
@@ -32,6 +31,7 @@ Dynamic: license
32
31
  Dynamic: license-file
33
32
  Dynamic: provides-extra
34
33
  Dynamic: requires-dist
34
+ Dynamic: requires-python
35
35
  Dynamic: summary
36
36
 
37
37
  Spanner dialect for SQLAlchemy
@@ -12,9 +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
16
-
15
+ from .sqlalchemy_spanner import MAX_SIZE, SpannerDialect
17
16
  from .version import __version__
18
17
 
19
-
20
- __all__ = (SpannerDialect, __version__)
18
+ __all__ = (
19
+ "MAX_SIZE",
20
+ "SpannerDialect",
21
+ "__version__",
22
+ )
@@ -16,7 +16,6 @@
16
16
 
17
17
  import collections
18
18
  import os
19
-
20
19
  from contextlib import contextmanager
21
20
 
22
21
  from google.api_core.exceptions import GoogleAPICallError
@@ -12,9 +12,9 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  import base64
15
-
16
15
  import re
17
16
 
17
+ import sqlalchemy
18
18
  from alembic.ddl.base import (
19
19
  ColumnNullable,
20
20
  ColumnType,
@@ -26,32 +26,30 @@ from alembic.ddl.base import (
26
26
  from google.api_core.client_options import ClientOptions
27
27
  from google.auth.credentials import AnonymousCredentials
28
28
  from google.cloud.spanner_v1 import Client, TransactionOptions
29
- from sqlalchemy.exc import NoSuchTableError
30
- from sqlalchemy.sql import elements
31
- from sqlalchemy import ForeignKeyConstraint, types, TypeDecorator, PickleType
29
+ from google.cloud.spanner_v1.data_types import JsonObject
30
+ from sqlalchemy import ForeignKeyConstraint, PickleType, TypeDecorator, types
32
31
  from sqlalchemy.engine.base import Engine
33
32
  from sqlalchemy.engine.default import DefaultDialect, DefaultExecutionContext
34
33
  from sqlalchemy.event import listens_for
34
+ from sqlalchemy.exc import NoSuchTableError
35
35
  from sqlalchemy.ext.compiler import compiles
36
36
  from sqlalchemy.pool import Pool
37
+ from sqlalchemy.sql import elements, expression
37
38
  from sqlalchemy.sql.compiler import (
38
- selectable,
39
+ OPERATORS,
40
+ RESERVED_WORDS,
39
41
  DDLCompiler,
40
42
  GenericTypeCompiler,
41
43
  IdentifierPreparer,
42
44
  SQLCompiler,
43
- OPERATORS,
44
- RESERVED_WORDS,
45
+ selectable,
45
46
  )
46
47
  from sqlalchemy.sql.default_comparator import operator_lookup
47
48
  from sqlalchemy.sql.operators import json_getitem_op
48
- from sqlalchemy.sql import expression
49
49
 
50
- from google.cloud.spanner_v1.data_types import JsonObject
51
50
  from google.cloud import spanner_dbapi
52
- from google.cloud.sqlalchemy_spanner._opentelemetry_tracing import trace_call
53
51
  from google.cloud.sqlalchemy_spanner import version as sqlalchemy_spanner_version
54
- import sqlalchemy
52
+ from google.cloud.sqlalchemy_spanner._opentelemetry_tracing import trace_call
55
53
 
56
54
  USING_SQLACLCHEMY_20 = False
57
55
  if sqlalchemy.__version__.split(".")[0] == "2":
@@ -122,8 +120,12 @@ _type_map = {
122
120
  "TIMESTAMP": types.TIMESTAMP,
123
121
  "ARRAY": types.ARRAY,
124
122
  "JSON": types.JSON,
123
+ "TOKENLIST": types.String,
125
124
  }
126
125
 
126
+ if hasattr(types, "UUID"):
127
+ _type_map["UUID"] = types.UUID
128
+
127
129
 
128
130
  _type_map_inv = {
129
131
  types.Boolean: "BOOL",
@@ -142,6 +144,12 @@ _type_map_inv = {
142
144
  types.NullType: "INT64",
143
145
  }
144
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
+
145
153
  _compound_keywords = {
146
154
  selectable.CompoundSelect.UNION: "UNION DISTINCT",
147
155
  selectable.CompoundSelect.UNION_ALL: "UNION ALL",
@@ -151,7 +159,10 @@ _compound_keywords = {
151
159
  selectable.CompoundSelect.INTERSECT_ALL: "INTERSECT ALL",
152
160
  }
153
161
 
154
- _max_size = 2621440
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
155
166
 
156
167
 
157
168
  def int_from_size(size_str):
@@ -163,7 +174,7 @@ def int_from_size(size_str):
163
174
  Returns:
164
175
  int: The column length value.
165
176
  """
166
- return _max_size if size_str == "MAX" else int(size_str)
177
+ return MAX_SIZE if size_str == "MAX" else int(size_str)
167
178
 
168
179
 
169
180
  def engine_to_connection(function):
@@ -223,9 +234,9 @@ class SpannerExecutionContext(DefaultExecutionContext):
223
234
  if ignore_transaction_warnings is not None:
224
235
  conn = self._dbapi_connection.connection
225
236
  if conn is not None and hasattr(conn, "_connection_variables"):
226
- conn._connection_variables[
227
- "ignore_transaction_warnings"
228
- ] = ignore_transaction_warnings
237
+ conn._connection_variables["ignore_transaction_warnings"] = (
238
+ ignore_transaction_warnings
239
+ )
229
240
 
230
241
  def fire_sequence(self, seq, type_):
231
242
  """Builds a statement for fetching next value of the sequence."""
@@ -416,7 +427,7 @@ class SpannerSQLCompiler(SQLCompiler):
416
427
  text += "\n LIMIT " + self.process(select._limit_clause, **kw)
417
428
  if select._offset_clause is not None:
418
429
  if select._limit_clause is None:
419
- text += f"\n LIMIT {9223372036854775807-select._offset}"
430
+ text += f"\n LIMIT {9223372036854775807 - select._offset}"
420
431
  text += " OFFSET " + self.process(select._offset_clause, **kw)
421
432
  return text
422
433
 
@@ -428,8 +439,10 @@ class SpannerSQLCompiler(SQLCompiler):
428
439
  )
429
440
  for c in expression._select_iterables(
430
441
  filter(
431
- lambda col: not col.dialect_options.get("spanner", {}).get(
432
- "exclude_from_returning", False
442
+ lambda col: (
443
+ not col.dialect_options.get("spanner", {}).get(
444
+ "exclude_from_returning", False
445
+ )
433
446
  ),
434
447
  returning_cols,
435
448
  )
@@ -764,6 +777,12 @@ class SpannerTypeCompiler(GenericTypeCompiler):
764
777
  Maps SQLAlchemy types to Spanner data types.
765
778
  """
766
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
+
767
786
  def visit_INTEGER(self, type_, **kw):
768
787
  return "INT64"
769
788
 
@@ -832,6 +851,7 @@ class SpannerDialect(DefaultDialect):
832
851
  paramstyle = "format"
833
852
  encoding = "utf-8"
834
853
  max_identifier_length = 256
854
+ max_size = MAX_SIZE
835
855
  _legacy_binary_type_literal_encoding = "utf-8"
836
856
  _default_isolation_level = "SERIALIZABLE"
837
857
 
@@ -846,6 +866,7 @@ class SpannerDialect(DefaultDialect):
846
866
  supports_identity_columns = True
847
867
  supports_native_boolean = True
848
868
  supports_native_decimal = True
869
+ supports_native_uuid = False
849
870
  supports_statement_cache = True
850
871
  # Spanner uses protos for enums. Creating a column like
851
872
  # Column("an_enum", Enum("A", "B", "C")) will result in a String
@@ -1025,9 +1046,7 @@ class SpannerDialect(DefaultDialect):
1025
1046
  SELECT table_name
1026
1047
  FROM information_schema.views
1027
1048
  WHERE TABLE_SCHEMA='{}'
1028
- """.format(
1029
- schema or ""
1030
- )
1049
+ """.format(schema or "")
1031
1050
 
1032
1051
  all_views = []
1033
1052
  with connection.connection.database.snapshot() as snap:
@@ -1056,9 +1075,7 @@ class SpannerDialect(DefaultDialect):
1056
1075
  SELECT name
1057
1076
  FROM information_schema.sequences
1058
1077
  WHERE SCHEMA='{}'
1059
- """.format(
1060
- schema or ""
1061
- )
1078
+ """.format(schema or "")
1062
1079
  all_sequences = []
1063
1080
  with connection.connection.database.snapshot() as snap:
1064
1081
  rows = list(snap.execute_sql(sql))
@@ -1087,9 +1104,7 @@ class SpannerDialect(DefaultDialect):
1087
1104
  SELECT view_definition
1088
1105
  FROM information_schema.views
1089
1106
  WHERE TABLE_SCHEMA='{schema_name}' AND TABLE_NAME='{view_name}'
1090
- """.format(
1091
- schema_name=schema or "", view_name=view_name
1092
- )
1107
+ """.format(schema_name=schema or "", view_name=view_name)
1093
1108
 
1094
1109
  with connection.connection.database.snapshot() as snap:
1095
1110
  rows = list(snap.execute_sql(sql))
@@ -1308,6 +1323,7 @@ class SpannerDialect(DefaultDialect):
1308
1323
  {table_type_query}
1309
1324
  {schema_filter_query}
1310
1325
  i.index_type != 'PRIMARY_KEY'
1326
+ AND i.index_type != 'SEARCH'
1311
1327
  AND i.spanner_is_managed = FALSE
1312
1328
  GROUP BY i.table_catalog, i.table_schema, i.table_name,
1313
1329
  i.index_name, i.is_unique
@@ -1332,7 +1348,9 @@ class SpannerDialect(DefaultDialect):
1332
1348
  "column_names": row[3],
1333
1349
  "unique": row[4],
1334
1350
  "column_sorting": {
1335
- col: order.lower() for col, order in zip(row[3], row[5])
1351
+ col: order.lower()
1352
+ for col, order in zip(row[3], row[5] or [])
1353
+ if order
1336
1354
  },
1337
1355
  "include_columns": include_columns if include_columns else [],
1338
1356
  "dialect_options": dialect_options,
@@ -1623,9 +1641,7 @@ class SpannerDialect(DefaultDialect):
1623
1641
  SELECT table_name
1624
1642
  FROM information_schema.tables
1625
1643
  WHERE table_type = 'BASE TABLE' AND table_schema = '{schema}'
1626
- """.format(
1627
- schema=schema or ""
1628
- )
1644
+ """.format(schema=schema or "")
1629
1645
 
1630
1646
  table_names = []
1631
1647
  with connection.connection.database.snapshot() as snap:
@@ -1661,9 +1677,7 @@ WHERE
1661
1677
  AND tc.TABLE_SCHEMA="{table_schema}"
1662
1678
  AND tc.CONSTRAINT_TYPE = "UNIQUE"
1663
1679
  AND tc.CONSTRAINT_NAME IS NOT NULL
1664
- """.format(
1665
- table_schema=schema or "", table_name=table_name
1666
- )
1680
+ """.format(table_schema=schema or "", table_name=table_name)
1667
1681
 
1668
1682
  cols = []
1669
1683
  with connection.connection.database.snapshot() as snap:
@@ -1696,9 +1710,7 @@ SELECT true
1696
1710
  FROM INFORMATION_SCHEMA.TABLES
1697
1711
  WHERE TABLE_SCHEMA="{table_schema}" AND TABLE_NAME="{table_name}"
1698
1712
  LIMIT 1
1699
- """.format(
1700
- table_schema=schema or "", table_name=table_name
1701
- )
1713
+ """.format(table_schema=schema or "", table_name=table_name)
1702
1714
  )
1703
1715
 
1704
1716
  for _ in rows:
@@ -1723,9 +1735,7 @@ LIMIT 1
1723
1735
  WHERE NAME="{sequence_name}"
1724
1736
  AND SCHEMA="{schema}"
1725
1737
  LIMIT 1
1726
- """.format(
1727
- sequence_name=sequence_name, schema=schema or ""
1728
- )
1738
+ """.format(sequence_name=sequence_name, schema=schema or "")
1729
1739
  )
1730
1740
 
1731
1741
  for _ in rows:
@@ -4,4 +4,4 @@
4
4
  # license that can be found in the LICENSE file or at
5
5
  # https://developers.google.com/open-source/licenses/bsd
6
6
 
7
- __version__ = "1.18.0"
7
+ __version__ = "1.20.0"
@@ -58,11 +58,10 @@ setuptools.setup(
58
58
  author="Google LLC",
59
59
  author_email="googleapis-packages@google.com",
60
60
  license="Apache 2.0",
61
+ python_requires=">=3.10",
61
62
  classifiers=[
62
63
  "Intended Audience :: Developers",
63
64
  "License :: OSI Approved :: Apache Software License",
64
- "Programming Language :: Python :: 3.8",
65
- "Programming Language :: Python :: 3.9",
66
65
  "Programming Language :: Python :: 3.10",
67
66
  "Programming Language :: Python :: 3.11",
68
67
  "Programming Language :: Python :: 3.12",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlalchemy-spanner
3
- Version: 1.18.0
3
+ Version: 1.20.0
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
@@ -8,13 +8,12 @@ Author-email: googleapis-packages@google.com
8
8
  License: Apache 2.0
9
9
  Classifier: Intended Audience :: Developers
10
10
  Classifier: License :: OSI Approved :: Apache Software License
11
- Classifier: Programming Language :: Python :: 3.8
12
- Classifier: Programming Language :: Python :: 3.9
13
11
  Classifier: Programming Language :: Python :: 3.10
14
12
  Classifier: Programming Language :: Python :: 3.11
15
13
  Classifier: Programming Language :: Python :: 3.12
16
14
  Classifier: Programming Language :: Python :: 3.13
17
15
  Classifier: Programming Language :: Python :: 3.14
16
+ Requires-Python: >=3.10
18
17
  License-File: LICENSE
19
18
  Requires-Dist: sqlalchemy>=1.1.13
20
19
  Requires-Dist: google-cloud-spanner>=3.55.0
@@ -32,6 +31,7 @@ Dynamic: license
32
31
  Dynamic: license-file
33
32
  Dynamic: provides-extra
34
33
  Dynamic: requires-dist
34
+ Dynamic: requires-python
35
35
  Dynamic: summary
36
36
 
37
37
  Spanner dialect for SQLAlchemy
@@ -18,113 +18,156 @@ import datetime
18
18
  import decimal
19
19
  import operator
20
20
  import os
21
- import pytest
22
21
  import random
23
22
  import time
24
23
  from unittest import mock
25
24
 
26
- from google.cloud.spanner_v1 import RequestOptions, Client
27
-
25
+ import pytest
28
26
  import sqlalchemy
29
- from sqlalchemy import create_engine
30
- from sqlalchemy import inspect
31
- from sqlalchemy import testing
32
- from sqlalchemy import ForeignKey
33
- from sqlalchemy import MetaData
34
- from sqlalchemy.schema import DDL
35
- from sqlalchemy.schema import Computed
36
- from sqlalchemy.testing import config
37
- from sqlalchemy.testing import engines
38
- from sqlalchemy.testing import eq_
39
- from sqlalchemy.testing import is_instance_of
40
- from sqlalchemy.testing import provide_metadata, emits_warning
41
- from sqlalchemy.testing import fixtures
42
- from sqlalchemy.testing import is_true
43
- from sqlalchemy.testing.schema import Column
44
- from sqlalchemy.testing.schema import Table
45
- from sqlalchemy import literal_column
46
- from sqlalchemy import select
47
- from sqlalchemy import util
48
- from sqlalchemy import event
49
- from sqlalchemy import exists
50
- from sqlalchemy import Boolean
51
- from sqlalchemy import Float
52
- from sqlalchemy import LargeBinary
53
- from sqlalchemy import String
27
+ from google.api_core.datetime_helpers import DatetimeWithNanoseconds
28
+ from google.cloud.spanner_v1 import Client, RequestOptions
29
+ from sqlalchemy import (
30
+ Boolean,
31
+ Float,
32
+ ForeignKey,
33
+ LargeBinary,
34
+ MetaData,
35
+ String,
36
+ create_engine,
37
+ event,
38
+ exists,
39
+ inspect,
40
+ literal_column,
41
+ select,
42
+ testing,
43
+ util,
44
+ )
54
45
  from sqlalchemy.ext.declarative import declarative_base
55
- from sqlalchemy.orm import relation
56
- from sqlalchemy.orm import Session
57
- from sqlalchemy.types import ARRAY
58
- from sqlalchemy.types import Integer
59
- from sqlalchemy.types import Numeric
60
- from sqlalchemy.types import Text
61
- from sqlalchemy.testing import requires
46
+ from sqlalchemy.orm import Session, relation
47
+ from sqlalchemy.schema import DDL, Computed
48
+ from sqlalchemy.testing import (
49
+ config,
50
+ emits_warning,
51
+ engines,
52
+ eq_,
53
+ fixtures,
54
+ is_instance_of,
55
+ is_true,
56
+ provide_metadata,
57
+ requires,
58
+ )
62
59
  from sqlalchemy.testing.fixtures import (
63
60
  ComputedReflectionFixtureTest as _ComputedReflectionFixtureTest,
64
61
  )
65
-
66
- from google.api_core.datetime_helpers import DatetimeWithNanoseconds
67
- from google.cloud import spanner_dbapi
68
-
62
+ from sqlalchemy.testing.schema import Column, Table
69
63
  from sqlalchemy.testing.suite.test_cte import * # noqa: F401, F403
70
- from sqlalchemy.testing.suite.test_ddl import * # noqa: F401, F403
71
- from sqlalchemy.testing.suite.test_dialect import * # noqa: F401, F403
72
- from sqlalchemy.testing.suite.test_insert import * # noqa: F401, F403
73
- from sqlalchemy.testing.suite.test_reflection import * # noqa: F401, F403
74
- from sqlalchemy.testing.suite.test_results import * # noqa: F401, F403
75
- from sqlalchemy.testing.suite.test_select import * # noqa: F401, F403
76
- from sqlalchemy.testing.suite.test_sequence import (
77
- SequenceTest as _SequenceTest,
78
- HasSequenceTest as _HasSequenceTest,
79
- ) # noqa: F401, F403
80
- from sqlalchemy.testing.suite.test_update_delete import * # noqa: F401, F403
81
-
82
64
  from sqlalchemy.testing.suite.test_cte import CTETest as _CTETest
83
- from sqlalchemy.testing.suite.test_ddl import TableDDLTest as _TableDDLTest
65
+ from sqlalchemy.testing.suite.test_ddl import * # noqa: F401, F403
84
66
  from sqlalchemy.testing.suite.test_ddl import (
85
67
  LongNameBlowoutTest as _LongNameBlowoutTest,
86
68
  )
69
+ from sqlalchemy.testing.suite.test_ddl import TableDDLTest as _TableDDLTest
70
+ from sqlalchemy.testing.suite.test_dialect import * # noqa: F401, F403
87
71
  from sqlalchemy.testing.suite.test_dialect import EscapingTest as _EscapingTest
72
+ from sqlalchemy.testing.suite.test_insert import * # noqa: F401, F403
88
73
  from sqlalchemy.testing.suite.test_insert import (
89
74
  InsertBehaviorTest as _InsertBehaviorTest,
90
75
  )
76
+ from sqlalchemy.testing.suite.test_reflection import * # noqa: F401, F403
77
+ from sqlalchemy.testing.suite.test_reflection import (
78
+ ComponentReflectionTest as _ComponentReflectionTest,
79
+ )
80
+ from sqlalchemy.testing.suite.test_reflection import (
81
+ CompositeKeyReflectionTest as _CompositeKeyReflectionTest,
82
+ )
83
+ from sqlalchemy.testing.suite.test_reflection import (
84
+ ComputedReflectionTest as _ComputedReflectionTest,
85
+ )
86
+ from sqlalchemy.testing.suite.test_reflection import (
87
+ QuotedNameArgumentTest as _QuotedNameArgumentTest,
88
+ )
89
+ from sqlalchemy.testing.suite.test_results import * # noqa: F401, F403
90
+ from sqlalchemy.testing.suite.test_results import RowFetchTest as _RowFetchTest
91
+ from sqlalchemy.testing.suite.test_select import * # noqa: F401, F403
91
92
  from sqlalchemy.testing.suite.test_select import ( # noqa: F401, F403
92
93
  CompoundSelectTest as _CompoundSelectTest,
94
+ )
95
+ from sqlalchemy.testing.suite.test_select import (
93
96
  ExistsTest as _ExistsTest,
97
+ )
98
+ from sqlalchemy.testing.suite.test_select import (
94
99
  IsOrIsNotDistinctFromTest as _IsOrIsNotDistinctFromTest,
100
+ )
101
+ from sqlalchemy.testing.suite.test_select import (
95
102
  LikeFunctionsTest as _LikeFunctionsTest,
103
+ )
104
+ from sqlalchemy.testing.suite.test_select import (
96
105
  OrderByLabelTest as _OrderByLabelTest,
97
106
  )
98
- from sqlalchemy.testing.suite.test_reflection import (
99
- QuotedNameArgumentTest as _QuotedNameArgumentTest,
100
- ComponentReflectionTest as _ComponentReflectionTest,
101
- CompositeKeyReflectionTest as _CompositeKeyReflectionTest,
102
- ComputedReflectionTest as _ComputedReflectionTest,
107
+ from sqlalchemy.testing.suite.test_sequence import (
108
+ HasSequenceTest as _HasSequenceTest,
103
109
  )
104
- from sqlalchemy.testing.suite.test_results import RowFetchTest as _RowFetchTest
105
- from sqlalchemy.testing.suite.test_types import ( # noqa: F401, F403
106
- _DateFixture as _DateFixtureTest,
107
- _LiteralRoundTripFixture,
108
- _UnicodeFixture as _UnicodeFixtureTest,
110
+ from sqlalchemy.testing.suite.test_sequence import (
111
+ SequenceTest as _SequenceTest,
112
+ ) # noqa: F401, F403
113
+ from sqlalchemy.testing.suite.test_types import (
109
114
  BooleanTest as _BooleanTest,
115
+ )
116
+ from sqlalchemy.testing.suite.test_types import (
110
117
  DateTest as _DateTest,
111
- DateTimeHistoricTest,
118
+ )
119
+ from sqlalchemy.testing.suite.test_types import (
112
120
  DateTimeCoercedToDateTimeTest as _DateTimeCoercedToDateTimeTest,
121
+ )
122
+ from sqlalchemy.testing.suite.test_types import ( # noqa: F401
123
+ DateTimeHistoricTest,
124
+ TimestampMicrosecondsTest,
125
+ _LiteralRoundTripFixture,
126
+ )
127
+ from sqlalchemy.testing.suite.test_types import (
113
128
  DateTimeMicrosecondsTest as _DateTimeMicrosecondsTest,
129
+ )
130
+ from sqlalchemy.testing.suite.test_types import (
114
131
  DateTimeTest as _DateTimeTest,
132
+ )
133
+ from sqlalchemy.testing.suite.test_types import (
115
134
  IntegerTest as _IntegerTest,
135
+ )
136
+ from sqlalchemy.testing.suite.test_types import (
116
137
  JSONTest as _JSONTest,
138
+ )
139
+ from sqlalchemy.testing.suite.test_types import (
117
140
  NumericTest as _NumericTest,
141
+ )
142
+ from sqlalchemy.testing.suite.test_types import (
118
143
  StringTest as _StringTest,
144
+ )
145
+ from sqlalchemy.testing.suite.test_types import (
119
146
  TextTest as _TextTest,
120
- TimeTest as _TimeTest,
147
+ )
148
+ from sqlalchemy.testing.suite.test_types import (
121
149
  TimeMicrosecondsTest as _TimeMicrosecondsTest,
122
- TimestampMicrosecondsTest,
123
- UnicodeVarcharTest as _UnicodeVarcharTest,
150
+ )
151
+ from sqlalchemy.testing.suite.test_types import (
152
+ TimeTest as _TimeTest,
153
+ )
154
+ from sqlalchemy.testing.suite.test_types import (
124
155
  UnicodeTextTest as _UnicodeTextTest,
125
156
  )
157
+ from sqlalchemy.testing.suite.test_types import (
158
+ UnicodeVarcharTest as _UnicodeVarcharTest,
159
+ )
160
+ from sqlalchemy.testing.suite.test_types import ( # noqa: F401, F403
161
+ _DateFixture as _DateFixtureTest,
162
+ )
163
+ from sqlalchemy.testing.suite.test_types import (
164
+ _UnicodeFixture as _UnicodeFixtureTest,
165
+ )
166
+ from sqlalchemy.testing.suite.test_update_delete import * # noqa: F401, F403
167
+ from sqlalchemy.types import ARRAY, Integer, Numeric, Text
126
168
  from test._helpers import get_db_url, get_project
127
169
 
170
+ from google.cloud import spanner_dbapi
128
171
  from google.cloud.sqlalchemy_spanner import version as sqlalchemy_spanner_version
129
172
 
130
173
  config.test_schema = ""
@@ -741,7 +784,7 @@ class ComponentReflectionTest(_ComponentReflectionTest):
741
784
  event.listen(
742
785
  user_tmp,
743
786
  "after_create",
744
- DDL("create temporary view user_tmp_v as " "select * from user_tmp"),
787
+ DDL("create temporary view user_tmp_v as select * from user_tmp"),
745
788
  )
746
789
  event.listen(user_tmp, "before_drop", DDL("drop view user_tmp_v"))
747
790
 
@@ -14,136 +14,199 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
- from datetime import timezone
18
17
  import decimal
19
18
  import operator
20
19
  import os
21
- import pytest
22
20
  import random
23
21
  import time
22
+ from datetime import timezone
24
23
  from unittest import mock
25
24
 
26
- from google.cloud.spanner_v1 import RequestOptions, Client
27
-
25
+ import pytest
28
26
  import sqlalchemy
29
- from sqlalchemy import create_engine, literal, FLOAT
30
- from sqlalchemy import inspect
31
- from sqlalchemy import testing
32
- from sqlalchemy import ForeignKey
33
- from sqlalchemy import MetaData
34
- from sqlalchemy.schema import DDL
35
- from sqlalchemy.schema import Computed
36
- from sqlalchemy.testing import config
37
- from sqlalchemy.testing import engines
38
- from sqlalchemy.testing import eq_
39
- from sqlalchemy.testing import is_instance_of
40
- from sqlalchemy.testing import provide_metadata, emits_warning
41
- from sqlalchemy.testing import fixtures
42
- from sqlalchemy.testing.provision import temp_table_keyword_args
43
- from sqlalchemy.testing.schema import Column
44
- from sqlalchemy.testing.schema import Table
45
- from sqlalchemy import literal_column
46
- from sqlalchemy import select
47
- from sqlalchemy import util
48
- from sqlalchemy import union
49
- from sqlalchemy import event
50
- from sqlalchemy import exists
51
- from sqlalchemy import Boolean
52
- from sqlalchemy import Float
53
- from sqlalchemy import LargeBinary
54
- from sqlalchemy import String
55
- from sqlalchemy.sql.expression import cast
56
- from sqlalchemy.ext.declarative import declarative_base
57
- from sqlalchemy.orm import relation
58
- from sqlalchemy.orm import Session
59
- from sqlalchemy.types import Integer
60
- from sqlalchemy.types import Numeric
61
- from sqlalchemy.types import Text
62
- from sqlalchemy.testing import requires
63
- from sqlalchemy.testing import is_true
27
+ from google.api_core.datetime_helpers import DatetimeWithNanoseconds
28
+ from google.cloud import spanner_dbapi
29
+ from google.cloud.spanner_v1 import Client, RequestOptions
30
+ from google.cloud.sqlalchemy_spanner import version as sqlalchemy_spanner_version
31
+ from sqlalchemy import (
32
+ FLOAT,
33
+ Boolean,
34
+ Float,
35
+ ForeignKey,
36
+ LargeBinary,
37
+ MetaData,
38
+ String,
39
+ create_engine,
40
+ event,
41
+ exists,
42
+ inspect,
43
+ literal,
44
+ literal_column,
45
+ select,
46
+ testing,
47
+ union,
48
+ util,
49
+ )
64
50
  from sqlalchemy import types as sql_types
51
+ from sqlalchemy.ext.declarative import declarative_base
52
+ from sqlalchemy.orm import Session, relation
53
+ from sqlalchemy.schema import DDL, Computed
54
+ from sqlalchemy.sql.expression import cast
55
+ from sqlalchemy.testing import (
56
+ config,
57
+ emits_warning,
58
+ engines,
59
+ eq_,
60
+ fixtures,
61
+ is_instance_of,
62
+ is_true,
63
+ provide_metadata,
64
+ requires,
65
+ )
65
66
  from sqlalchemy.testing.fixtures import (
66
67
  ComputedReflectionFixtureTest as _ComputedReflectionFixtureTest,
67
68
  )
68
-
69
- from google.api_core.datetime_helpers import DatetimeWithNanoseconds
70
-
71
- from google.cloud import spanner_dbapi
72
-
69
+ from sqlalchemy.testing.provision import temp_table_keyword_args
70
+ from sqlalchemy.testing.schema import Column, Table
73
71
  from sqlalchemy.testing.suite.test_cte import * # noqa: F401, F403
74
- from sqlalchemy.testing.suite.test_ddl import * # noqa: F401, F403
75
- from sqlalchemy.testing.suite.test_dialect import * # noqa: F401, F403
76
- from sqlalchemy.testing.suite.test_insert import * # noqa: F401, F403
77
- from sqlalchemy.testing.suite.test_reflection import * # noqa: F401, F403
78
- from sqlalchemy.testing.suite.test_results import * # noqa: F401, F403
79
- from sqlalchemy.testing.suite.test_select import * # noqa: F401, F403
80
- from sqlalchemy.testing.suite.test_sequence import (
81
- SequenceTest as _SequenceTest,
82
- HasSequenceTest as _HasSequenceTest,
83
- HasSequenceTestEmpty as _HasSequenceTestEmpty,
84
- ) # noqa: F401, F403
85
- from sqlalchemy.testing.suite.test_update_delete import * # noqa: F401, F403
86
72
  from sqlalchemy.testing.suite.test_cte import CTETest as _CTETest
87
- from sqlalchemy.testing.suite.test_ddl import TableDDLTest as _TableDDLTest
73
+ from sqlalchemy.testing.suite.test_ddl import * # noqa: F401, F403
88
74
  from sqlalchemy.testing.suite.test_ddl import (
89
75
  FutureTableDDLTest as _FutureTableDDLTest,
90
- LongNameBlowoutTest as _LongNameBlowoutTest,
91
76
  )
92
- from sqlalchemy.testing.suite.test_update_delete import (
93
- SimpleUpdateDeleteTest as _SimpleUpdateDeleteTest,
77
+ from sqlalchemy.testing.suite.test_ddl import (
78
+ LongNameBlowoutTest as _LongNameBlowoutTest,
94
79
  )
80
+ from sqlalchemy.testing.suite.test_ddl import TableDDLTest as _TableDDLTest
81
+ from sqlalchemy.testing.suite.test_dialect import * # noqa: F401, F403
95
82
  from sqlalchemy.testing.suite.test_dialect import (
96
83
  DifficultParametersTest as _DifficultParametersTest,
84
+ )
85
+ from sqlalchemy.testing.suite.test_dialect import (
97
86
  EscapingTest as _EscapingTest,
98
87
  )
88
+ from sqlalchemy.testing.suite.test_insert import * # noqa: F401, F403
99
89
  from sqlalchemy.testing.suite.test_insert import (
100
90
  InsertBehaviorTest as _InsertBehaviorTest,
101
91
  )
92
+ from sqlalchemy.testing.suite.test_reflection import * # noqa: F401, F403
93
+ from sqlalchemy.testing.suite.test_reflection import (
94
+ ComponentReflectionTest as _ComponentReflectionTest,
95
+ )
96
+ from sqlalchemy.testing.suite.test_reflection import (
97
+ ComponentReflectionTestExtra as _ComponentReflectionTestExtra,
98
+ )
99
+ from sqlalchemy.testing.suite.test_reflection import (
100
+ CompositeKeyReflectionTest as _CompositeKeyReflectionTest,
101
+ )
102
+ from sqlalchemy.testing.suite.test_reflection import (
103
+ ComputedReflectionTest as _ComputedReflectionTest,
104
+ )
105
+ from sqlalchemy.testing.suite.test_reflection import (
106
+ HasIndexTest as _HasIndexTest,
107
+ )
108
+ from sqlalchemy.testing.suite.test_reflection import (
109
+ HasTableTest as _HasTableTest,
110
+ )
111
+ from sqlalchemy.testing.suite.test_reflection import (
112
+ QuotedNameArgumentTest as _QuotedNameArgumentTest,
113
+ )
114
+ from sqlalchemy.testing.suite.test_results import * # noqa: F401, F403
115
+ from sqlalchemy.testing.suite.test_results import RowFetchTest as _RowFetchTest
116
+ from sqlalchemy.testing.suite.test_select import * # noqa: F401, F403
102
117
  from sqlalchemy.testing.suite.test_select import ( # noqa: F401, F403
103
118
  CompoundSelectTest as _CompoundSelectTest,
119
+ )
120
+ from sqlalchemy.testing.suite.test_select import (
104
121
  ExistsTest as _ExistsTest,
122
+ )
123
+ from sqlalchemy.testing.suite.test_select import (
105
124
  FetchLimitOffsetTest as _FetchLimitOffsetTest,
125
+ )
126
+ from sqlalchemy.testing.suite.test_select import (
106
127
  IdentityAutoincrementTest as _IdentityAutoincrementTest,
128
+ )
129
+ from sqlalchemy.testing.suite.test_select import (
107
130
  IsOrIsNotDistinctFromTest as _IsOrIsNotDistinctFromTest,
131
+ )
132
+ from sqlalchemy.testing.suite.test_select import (
108
133
  LikeFunctionsTest as _LikeFunctionsTest,
134
+ )
135
+ from sqlalchemy.testing.suite.test_select import (
109
136
  OrderByLabelTest as _OrderByLabelTest,
137
+ )
138
+ from sqlalchemy.testing.suite.test_select import (
110
139
  PostCompileParamsTest as _PostCompileParamsTest,
111
140
  )
112
- from sqlalchemy.testing.suite.test_reflection import (
113
- ComponentReflectionTestExtra as _ComponentReflectionTestExtra,
114
- QuotedNameArgumentTest as _QuotedNameArgumentTest,
115
- ComponentReflectionTest as _ComponentReflectionTest,
116
- CompositeKeyReflectionTest as _CompositeKeyReflectionTest,
117
- ComputedReflectionTest as _ComputedReflectionTest,
118
- HasIndexTest as _HasIndexTest,
119
- HasTableTest as _HasTableTest,
141
+ from sqlalchemy.testing.suite.test_sequence import (
142
+ HasSequenceTest as _HasSequenceTest,
120
143
  )
121
- from sqlalchemy.testing.suite.test_results import RowFetchTest as _RowFetchTest
144
+ from sqlalchemy.testing.suite.test_sequence import (
145
+ HasSequenceTestEmpty as _HasSequenceTestEmpty,
146
+ )
147
+ from sqlalchemy.testing.suite.test_sequence import (
148
+ SequenceTest as _SequenceTest,
149
+ ) # noqa: F401, F403
122
150
  from sqlalchemy.testing.suite.test_types import ( # noqa: F401, F403
123
151
  BooleanTest as _BooleanTest,
152
+ )
153
+ from sqlalchemy.testing.suite.test_types import (
124
154
  DateTest as _DateTest,
125
- _DateFixture as __DateFixture,
126
- DateTimeHistoricTest,
155
+ )
156
+ from sqlalchemy.testing.suite.test_types import (
127
157
  DateTimeCoercedToDateTimeTest as _DateTimeCoercedToDateTimeTest,
158
+ )
159
+ from sqlalchemy.testing.suite.test_types import ( # noqa: F401
160
+ DateTimeHistoricTest,
161
+ TimestampMicrosecondsTest,
162
+ _LiteralRoundTripFixture,
163
+ )
164
+ from sqlalchemy.testing.suite.test_types import (
128
165
  DateTimeMicrosecondsTest as _DateTimeMicrosecondsTest,
166
+ )
167
+ from sqlalchemy.testing.suite.test_types import (
129
168
  DateTimeTest as _DateTimeTest,
169
+ )
170
+ from sqlalchemy.testing.suite.test_types import (
130
171
  IntegerTest as _IntegerTest,
172
+ )
173
+ from sqlalchemy.testing.suite.test_types import (
131
174
  JSONTest as _JSONTest,
132
- _LiteralRoundTripFixture,
175
+ )
176
+ from sqlalchemy.testing.suite.test_types import (
133
177
  NumericTest as _NumericTest,
178
+ )
179
+ from sqlalchemy.testing.suite.test_types import (
134
180
  StringTest as _StringTest,
181
+ )
182
+ from sqlalchemy.testing.suite.test_types import (
135
183
  TextTest as _TextTest,
136
- TimeTest as _TimeTest,
184
+ )
185
+ from sqlalchemy.testing.suite.test_types import (
137
186
  TimeMicrosecondsTest as _TimeMicrosecondsTest,
138
- TimestampMicrosecondsTest,
139
- UnicodeVarcharTest as _UnicodeVarcharTest,
187
+ )
188
+ from sqlalchemy.testing.suite.test_types import (
189
+ TimeTest as _TimeTest,
190
+ )
191
+ from sqlalchemy.testing.suite.test_types import (
140
192
  UnicodeTextTest as _UnicodeTextTest,
193
+ )
194
+ from sqlalchemy.testing.suite.test_types import (
195
+ UnicodeVarcharTest as _UnicodeVarcharTest,
196
+ )
197
+ from sqlalchemy.testing.suite.test_types import (
198
+ _DateFixture as __DateFixture,
199
+ )
200
+ from sqlalchemy.testing.suite.test_types import (
141
201
  _UnicodeFixture as __UnicodeFixture,
142
202
  )
143
- from tests._helpers import get_db_url, get_project
144
-
145
- from google.cloud.sqlalchemy_spanner import version as sqlalchemy_spanner_version
203
+ from sqlalchemy.testing.suite.test_update_delete import * # noqa: F401, F403
204
+ from sqlalchemy.testing.suite.test_update_delete import (
205
+ SimpleUpdateDeleteTest as _SimpleUpdateDeleteTest,
206
+ )
207
+ from sqlalchemy.types import Integer, Numeric, Text
146
208
 
209
+ from tests._helpers import get_db_url, get_project
147
210
 
148
211
  config.test_schema = ""
149
212
 
@@ -187,7 +250,7 @@ class ComponentReflectionTestExtra(_ComponentReflectionTestExtra):
187
250
  @testing.requires.table_reflection
188
251
  def test_nullable_reflection(self, connection, metadata):
189
252
  t = Table(
190
- "t",
253
+ "t_nullable_reflection",
191
254
  metadata,
192
255
  Column("a", Integer, nullable=True),
193
256
  Column("b", Integer, nullable=False),
@@ -197,19 +260,21 @@ class ComponentReflectionTestExtra(_ComponentReflectionTestExtra):
197
260
  eq_(
198
261
  dict(
199
262
  (col["name"], col["nullable"])
200
- for col in inspect(connection).get_columns("t")
263
+ for col in inspect(connection).get_columns("t_nullable_reflection")
201
264
  ),
202
265
  {"a": True, "b": False},
203
266
  )
204
267
 
205
268
  def _type_round_trip(self, connection, metadata, *types):
206
269
  t = Table(
207
- "t", metadata, *[Column("t%d" % i, type_) for i, type_ in enumerate(types)]
270
+ "t_type_round_trip",
271
+ metadata,
272
+ *[Column("t%d" % i, type_) for i, type_ in enumerate(types)],
208
273
  )
209
274
  t.create(connection)
210
275
  connection.connection.commit()
211
276
 
212
- return [c["type"] for c in inspect(connection).get_columns("t")]
277
+ return [c["type"] for c in inspect(connection).get_columns("t_type_round_trip")]
213
278
 
214
279
  @testing.requires.table_reflection
215
280
  def test_numeric_reflection(self, connection, metadata):
@@ -633,7 +698,7 @@ class ComponentReflectionTest(_ComponentReflectionTest):
633
698
  event.listen(
634
699
  user_tmp,
635
700
  "after_create",
636
- DDL("create temporary view user_tmp_v as " "select * from user_tmp"),
701
+ DDL("create temporary view user_tmp_v as select * from user_tmp"),
637
702
  )
638
703
  event.listen(user_tmp, "before_drop", DDL("drop view user_tmp_v"))
639
704
 
@@ -1144,7 +1209,7 @@ class EscapingTest(_EscapingTest):
1144
1209
  Overriding the test to avoid the same failure.
1145
1210
  """
1146
1211
  m = self.metadata
1147
- t = Table("t", m, Column("data", String(50)))
1212
+ t = Table("t_percent_signs", m, Column("data", String(50)))
1148
1213
  t.create(config.db)
1149
1214
  with config.db.begin() as conn:
1150
1215
  conn.execute(t.insert(), dict(data="some % value"))
@@ -1488,7 +1553,7 @@ class NumericTest(_NumericTest):
1488
1553
  @testing.emits_warning(r".*does \*not\* support Decimal objects natively")
1489
1554
  def run(type_, input_, output, filter_=None, check_scale=False):
1490
1555
  t = Table(
1491
- "t",
1556
+ "t_do_numeric",
1492
1557
  metadata,
1493
1558
  Column("x", type_),
1494
1559
  Column("id", Integer, primary_key=True),
@@ -1996,7 +2061,7 @@ class PostCompileParamsTest(_PostCompileParamsTest):
1996
2061
 
1997
2062
  asserter.assert_(
1998
2063
  sqlalchemy.testing.assertsql.CursorSQL(
1999
- "SELECT some_table.id \nFROM some_table " "\nWHERE some_table.x = 10",
2064
+ "SELECT some_table.id \nFROM some_table \nWHERE some_table.x = 10",
2000
2065
  [] if config.db.dialect.positional else {},
2001
2066
  )
2002
2067
  )
@@ -14,152 +14,217 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
- from datetime import timezone
18
17
  import decimal
19
18
  import operator
20
19
  import os
21
- import pytest
22
20
  import random
23
21
  import time
22
+ from datetime import timezone
24
23
  from unittest import mock
25
24
 
26
- from google.cloud.spanner_v1 import RequestOptions, Client
25
+ import pytest
27
26
  import sqlalchemy
28
- from sqlalchemy import create_engine, literal, FLOAT
29
- from sqlalchemy.engine import Inspector
30
- from sqlalchemy import inspect
31
- from sqlalchemy import testing
32
- from sqlalchemy import ForeignKey
33
- from sqlalchemy import MetaData
34
- from sqlalchemy.engine import ObjectKind
35
- from sqlalchemy.engine import ObjectScope
36
- from sqlalchemy.schema import DDL
37
- from sqlalchemy.schema import Computed
38
- from sqlalchemy.testing import config
39
- from sqlalchemy.testing import engines
40
- from sqlalchemy.testing import eq_
41
- from sqlalchemy.testing import is_instance_of
42
- from sqlalchemy.testing import provide_metadata, emits_warning
43
- from sqlalchemy.testing import is_true
44
- from sqlalchemy.testing import fixtures
45
- from sqlalchemy.testing.provision import temp_table_keyword_args
46
- from sqlalchemy.testing.schema import Column
47
- from sqlalchemy.testing.schema import Table
48
- from sqlalchemy import literal_column
49
- from sqlalchemy import select
50
- from sqlalchemy import util
51
- from sqlalchemy import union
52
- from sqlalchemy import event
53
- from sqlalchemy import exists
54
- from sqlalchemy import Boolean
55
- from sqlalchemy import Float
56
- from sqlalchemy import LargeBinary
57
- from sqlalchemy import String
58
- from sqlalchemy.sql.expression import cast
27
+ from google.api_core.datetime_helpers import DatetimeWithNanoseconds
28
+ from google.cloud.spanner_v1 import Client, RequestOptions
29
+ from sqlalchemy import (
30
+ FLOAT,
31
+ Boolean,
32
+ Float,
33
+ ForeignKey,
34
+ Index,
35
+ LargeBinary,
36
+ MetaData,
37
+ String,
38
+ create_engine,
39
+ event,
40
+ exists,
41
+ inspect,
42
+ literal,
43
+ literal_column,
44
+ select,
45
+ testing,
46
+ types,
47
+ union,
48
+ util,
49
+ )
50
+ from sqlalchemy.engine import Inspector, ObjectKind, ObjectScope
59
51
  from sqlalchemy.ext.declarative import declarative_base
60
- from sqlalchemy.orm import relationship
61
- from sqlalchemy.orm import Session
62
- from sqlalchemy.types import Integer
63
- from sqlalchemy.types import Numeric
64
-
65
- from sqlalchemy.types import Text
66
- from sqlalchemy.testing import requires
67
- from sqlalchemy import Index
68
- from sqlalchemy import types
52
+ from sqlalchemy.orm import Session, relationship
53
+ from sqlalchemy.schema import DDL, Computed
54
+ from sqlalchemy.sql.expression import cast
55
+ from sqlalchemy.testing import (
56
+ config,
57
+ emits_warning,
58
+ engines,
59
+ eq_,
60
+ fixtures,
61
+ is_instance_of,
62
+ is_true,
63
+ provide_metadata,
64
+ requires,
65
+ )
69
66
  from sqlalchemy.testing.fixtures import (
70
67
  ComputedReflectionFixtureTest as _ComputedReflectionFixtureTest,
71
68
  )
72
-
73
- from google.api_core.datetime_helpers import DatetimeWithNanoseconds
74
-
75
- from google.cloud import spanner_dbapi
76
-
69
+ from sqlalchemy.testing.provision import temp_table_keyword_args
70
+ from sqlalchemy.testing.schema import Column, Table
77
71
  from sqlalchemy.testing.suite.test_cte import * # noqa: F401, F403
78
- from sqlalchemy.testing.suite.test_ddl import * # noqa: F401, F403
79
- from sqlalchemy.testing.suite.test_dialect import * # noqa: F401, F403
80
- from sqlalchemy.testing.suite.test_insert import * # noqa: F401, F403
81
- from sqlalchemy.testing.suite.test_reflection import * # noqa: F401, F403
82
- from sqlalchemy.testing.suite.test_deprecations import * # noqa: F401, F403
83
- from sqlalchemy.testing.suite.test_results import * # noqa: F401, F403
84
- from sqlalchemy.testing.suite.test_select import (
85
- BitwiseTest as _BitwiseTest,
86
- ) # noqa: F401, F403
87
- from sqlalchemy.testing.suite.test_sequence import (
88
- SequenceTest as _SequenceTest,
89
- HasSequenceTest as _HasSequenceTest,
90
- HasSequenceTestEmpty as _HasSequenceTestEmpty,
91
- ) # noqa: F401, F403
92
- from sqlalchemy.testing.suite.test_unicode_ddl import * # noqa: F401, F403
93
- from sqlalchemy.testing.suite.test_update_delete import * # noqa: F401, F403
94
72
  from sqlalchemy.testing.suite.test_cte import CTETest as _CTETest
95
- from sqlalchemy.testing.suite.test_ddl import TableDDLTest as _TableDDLTest
73
+ from sqlalchemy.testing.suite.test_ddl import * # noqa: F401, F403
96
74
  from sqlalchemy.testing.suite.test_ddl import (
97
75
  FutureTableDDLTest as _FutureTableDDLTest,
98
- LongNameBlowoutTest as _LongNameBlowoutTest,
99
76
  )
100
- from sqlalchemy.testing.suite.test_update_delete import (
101
- SimpleUpdateDeleteTest as _SimpleUpdateDeleteTest,
77
+ from sqlalchemy.testing.suite.test_ddl import (
78
+ LongNameBlowoutTest as _LongNameBlowoutTest,
102
79
  )
80
+ from sqlalchemy.testing.suite.test_ddl import TableDDLTest as _TableDDLTest
81
+ from sqlalchemy.testing.suite.test_deprecations import * # noqa: F401, F403
82
+ from sqlalchemy.testing.suite.test_dialect import * # noqa: F401, F403
103
83
  from sqlalchemy.testing.suite.test_dialect import (
104
84
  DifficultParametersTest as _DifficultParametersTest,
85
+ )
86
+ from sqlalchemy.testing.suite.test_dialect import (
105
87
  EscapingTest as _EscapingTest,
88
+ )
89
+ from sqlalchemy.testing.suite.test_dialect import (
106
90
  ReturningGuardsTest as _ReturningGuardsTest,
107
91
  )
92
+ from sqlalchemy.testing.suite.test_insert import * # noqa: F401, F403
108
93
  from sqlalchemy.testing.suite.test_insert import (
109
94
  InsertBehaviorTest as _InsertBehaviorTest,
110
95
  )
96
+ from sqlalchemy.testing.suite.test_reflection import * # noqa: F401, F403
97
+ from sqlalchemy.testing.suite.test_reflection import (
98
+ ComponentReflectionTest as _ComponentReflectionTest,
99
+ )
100
+ from sqlalchemy.testing.suite.test_reflection import ( # noqa: F401, F403
101
+ ComponentReflectionTestExtra as _ComponentReflectionTestExtra,
102
+ )
103
+ from sqlalchemy.testing.suite.test_reflection import (
104
+ CompositeKeyReflectionTest as _CompositeKeyReflectionTest,
105
+ )
106
+ from sqlalchemy.testing.suite.test_reflection import (
107
+ ComputedReflectionTest as _ComputedReflectionTest,
108
+ )
109
+ from sqlalchemy.testing.suite.test_reflection import (
110
+ HasIndexTest as _HasIndexTest,
111
+ )
112
+ from sqlalchemy.testing.suite.test_reflection import (
113
+ HasTableTest as _HasTableTest,
114
+ )
115
+ from sqlalchemy.testing.suite.test_reflection import (
116
+ QuotedNameArgumentTest as _QuotedNameArgumentTest,
117
+ )
118
+ from sqlalchemy.testing.suite.test_results import * # noqa: F401, F403
119
+ from sqlalchemy.testing.suite.test_results import (
120
+ RowFetchTest as _RowFetchTest,
121
+ )
122
+ from sqlalchemy.testing.suite.test_select import (
123
+ BitwiseTest as _BitwiseTest,
124
+ ) # noqa: F401, F403
111
125
  from sqlalchemy.testing.suite.test_select import ( # noqa: F401, F403
112
126
  CompoundSelectTest as _CompoundSelectTest,
127
+ )
128
+ from sqlalchemy.testing.suite.test_select import (
113
129
  ExistsTest as _ExistsTest,
130
+ )
131
+ from sqlalchemy.testing.suite.test_select import (
114
132
  FetchLimitOffsetTest as _FetchLimitOffsetTest,
133
+ )
134
+ from sqlalchemy.testing.suite.test_select import (
115
135
  IdentityAutoincrementTest as _IdentityAutoincrementTest,
136
+ )
137
+ from sqlalchemy.testing.suite.test_select import (
116
138
  IsOrIsNotDistinctFromTest as _IsOrIsNotDistinctFromTest,
139
+ )
140
+ from sqlalchemy.testing.suite.test_select import (
117
141
  LikeFunctionsTest as _LikeFunctionsTest,
142
+ )
143
+ from sqlalchemy.testing.suite.test_select import (
118
144
  OrderByLabelTest as _OrderByLabelTest,
145
+ )
146
+ from sqlalchemy.testing.suite.test_select import (
119
147
  PostCompileParamsTest as _PostCompileParamsTest,
148
+ )
149
+ from sqlalchemy.testing.suite.test_select import (
120
150
  SameNamedSchemaTableTest as _SameNamedSchemaTableTest,
121
151
  )
122
- from sqlalchemy.testing.suite.test_reflection import ( # noqa: F401, F403
123
- ComponentReflectionTestExtra as _ComponentReflectionTestExtra,
124
- QuotedNameArgumentTest as _QuotedNameArgumentTest,
125
- ComponentReflectionTest as _ComponentReflectionTest,
126
- CompositeKeyReflectionTest as _CompositeKeyReflectionTest,
127
- ComputedReflectionTest as _ComputedReflectionTest,
128
- HasIndexTest as _HasIndexTest,
129
- HasTableTest as _HasTableTest,
152
+ from sqlalchemy.testing.suite.test_sequence import (
153
+ HasSequenceTest as _HasSequenceTest,
130
154
  )
131
- from sqlalchemy.testing.suite.test_results import (
132
- RowFetchTest as _RowFetchTest,
155
+ from sqlalchemy.testing.suite.test_sequence import (
156
+ HasSequenceTestEmpty as _HasSequenceTestEmpty,
133
157
  )
158
+ from sqlalchemy.testing.suite.test_sequence import (
159
+ SequenceTest as _SequenceTest,
160
+ ) # noqa: F401, F403
134
161
  from sqlalchemy.testing.suite.test_types import ( # noqa: F401, F403
135
162
  BooleanTest as _BooleanTest,
163
+ ) # noqa: F401, F403
164
+ from sqlalchemy.testing.suite.test_types import (
136
165
  DateTest as _DateTest,
137
- _DateFixture as __DateFixture,
138
- DateTimeHistoricTest,
166
+ )
167
+ from sqlalchemy.testing.suite.test_types import (
139
168
  DateTimeCoercedToDateTimeTest as _DateTimeCoercedToDateTimeTest,
169
+ )
170
+ from sqlalchemy.testing.suite.test_types import ( # noqa: F401
171
+ DateTimeHistoricTest,
172
+ TimestampMicrosecondsTest,
173
+ _LiteralRoundTripFixture,
174
+ )
175
+ from sqlalchemy.testing.suite.test_types import (
140
176
  DateTimeMicrosecondsTest as _DateTimeMicrosecondsTest,
177
+ )
178
+ from sqlalchemy.testing.suite.test_types import (
141
179
  DateTimeTest as _DateTimeTest,
180
+ )
181
+ from sqlalchemy.testing.suite.test_types import (
142
182
  IntegerTest as _IntegerTest,
183
+ )
184
+ from sqlalchemy.testing.suite.test_types import (
143
185
  JSONTest as _JSONTest,
144
- _LiteralRoundTripFixture,
186
+ )
187
+ from sqlalchemy.testing.suite.test_types import (
145
188
  NumericTest as _NumericTest,
189
+ )
190
+ from sqlalchemy.testing.suite.test_types import (
146
191
  StringTest as _StringTest,
192
+ )
193
+ from sqlalchemy.testing.suite.test_types import (
147
194
  TextTest as _TextTest,
148
- TimeTest as _TimeTest,
195
+ )
196
+ from sqlalchemy.testing.suite.test_types import (
149
197
  TimeMicrosecondsTest as _TimeMicrosecondsTest,
150
- TimestampMicrosecondsTest,
151
- UnicodeVarcharTest as _UnicodeVarcharTest,
198
+ )
199
+ from sqlalchemy.testing.suite.test_types import (
200
+ TimeTest as _TimeTest,
201
+ )
202
+ from sqlalchemy.testing.suite.test_types import (
152
203
  UnicodeTextTest as _UnicodeTextTest,
204
+ )
205
+ from sqlalchemy.testing.suite.test_types import (
206
+ UnicodeVarcharTest as _UnicodeVarcharTest,
207
+ )
208
+ from sqlalchemy.testing.suite.test_types import (
209
+ _DateFixture as __DateFixture,
210
+ )
211
+ from sqlalchemy.testing.suite.test_types import (
153
212
  _UnicodeFixture as __UnicodeFixture,
154
- ) # noqa: F401, F403
213
+ )
214
+ from sqlalchemy.testing.suite.test_unicode_ddl import * # noqa: F401, F403
215
+ from sqlalchemy.testing.suite.test_update_delete import * # noqa: F401, F403
216
+ from sqlalchemy.testing.suite.test_update_delete import (
217
+ SimpleUpdateDeleteTest as _SimpleUpdateDeleteTest,
218
+ )
219
+ from sqlalchemy.types import Integer, Numeric, Text
220
+
221
+ from google.cloud import spanner_dbapi
222
+ from google.cloud.sqlalchemy_spanner import version as sqlalchemy_spanner_version
155
223
  from tests._helpers import (
156
224
  get_db_url,
157
225
  get_project,
158
226
  )
159
227
 
160
- from google.cloud.sqlalchemy_spanner import version as sqlalchemy_spanner_version
161
-
162
-
163
228
  config.test_schema = ""
164
229
 
165
230
 
@@ -1186,7 +1251,7 @@ class ComponentReflectionTest(_ComponentReflectionTest):
1186
1251
  event.listen(
1187
1252
  user_tmp,
1188
1253
  "after_create",
1189
- DDL("create temporary view user_tmp_v as " "select * from user_tmp"),
1254
+ DDL("create temporary view user_tmp_v as select * from user_tmp"),
1190
1255
  )
1191
1256
  event.listen(user_tmp, "before_drop", DDL("drop view user_tmp_v"))
1192
1257
 
@@ -2878,7 +2943,7 @@ class PostCompileParamsTest(_PostCompileParamsTest):
2878
2943
 
2879
2944
  asserter.assert_(
2880
2945
  sqlalchemy.testing.assertsql.CursorSQL(
2881
- "SELECT some_table.id \nFROM some_table " "\nWHERE some_table.x = 10",
2946
+ "SELECT some_table.id \nFROM some_table \nWHERE some_table.x = 10",
2882
2947
  [] if config.db.dialect.positional else {},
2883
2948
  )
2884
2949
  )
@@ -13,8 +13,8 @@
13
13
  # limitations under the License.
14
14
 
15
15
  from sqlalchemy.testing import exclusions
16
- from sqlalchemy.testing.requirements import SuiteRequirements
17
16
  from sqlalchemy.testing.exclusions import against, only_on
17
+ from sqlalchemy.testing.requirements import SuiteRequirements
18
18
 
19
19
 
20
20
  class Requirements(SuiteRequirements): # pragma: no cover