From 9b981286d53b941737552e28c8b3caa5dfbdd943 Mon Sep 17 00:00:00 2001 From: Ilya Gurov Date: Thu, 27 Jan 2022 21:57:28 +0300 Subject: [PATCH 01/27] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2f1be807..9f89d405 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ name = "sqlalchemy-spanner" description = "SQLAlchemy dialect integrated into Cloud Spanner database" dependencies = [ - "sqlalchemy>=1.1.13, <=1.3.23", + "sqlalchemy>=1.1.13", "google-cloud-spanner>=3.12.0", "alembic", ] From 8daaaed7ddc9276f36320eff1fc11f52455ab981 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Fri, 28 Jan 2022 11:32:00 +0300 Subject: [PATCH 02/27] use SQLAlchemy 1.3 for 13 session --- noxfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/noxfile.py b/noxfile.py index fb9f923d..e1d18a53 100644 --- a/noxfile.py +++ b/noxfile.py @@ -133,6 +133,7 @@ def compliance_test_13(session): session.install("mock") session.install("-e", ".[tracing]") + session.run("pip", "install", "sqlalchemy>=1.1.13,<=1.3.23", "--force-reinstall") session.run("python", "create_test_database.py") session.run( From fa8f3c5742a570f38415db18bb9baa1d70d2357a Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Tue, 17 May 2022 14:38:07 -0700 Subject: [PATCH 03/27] fix: update nox configurations --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index e1d18a53..0ff6e5b3 100644 --- a/noxfile.py +++ b/noxfile.py @@ -68,7 +68,7 @@ class = StreamHandler )""" -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["google", "test", "noxfile.py", "setup.py", "samples"] DEFAULT_PYTHON_VERSION = "3.8" From a3b510a6b4b246f2a1ec5741068adc6de97bbbe0 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Tue, 17 May 2022 14:43:54 -0700 Subject: [PATCH 04/27] fix: format files with a newer versions of black --- noxfile.py | 23 +++++++++++++++++------ samples/conftest.py | 3 ++- test/_helpers.py | 3 ++- test/benchmark.py | 12 ++++++++---- test/test_suite_13.py | 21 ++++++++++++++++----- test/unit/test_opentelemetry_tracing.py | 3 ++- 6 files changed, 47 insertions(+), 18 deletions(-) diff --git a/noxfile.py b/noxfile.py index 0ff6e5b3..a54a9907 100644 --- a/noxfile.py +++ b/noxfile.py @@ -82,10 +82,15 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *BLACK_PATHS, ) session.run( - "flake8", "google", "test", "--max-line-length=88", + "flake8", + "google", + "test", + "--max-line-length=88", ) @@ -101,7 +106,8 @@ def blacken(session): """ session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *BLACK_PATHS, ) @@ -128,7 +134,9 @@ def compliance_test_13(session): ) session.install( - "pytest", "pytest-cov", "pytest-asyncio", + "pytest", + "pytest-cov", + "pytest-asyncio", ) session.install("mock") @@ -165,7 +173,9 @@ def compliance_test_14(session): ) session.install( - "pytest", "pytest-cov", "pytest-asyncio", + "pytest", + "pytest-cov", + "pytest-asyncio", ) session.install("mock") @@ -215,7 +225,8 @@ def migration_test(session): session.run("python", "create_test_database.py") project = os.getenv( - "GOOGLE_CLOUD_PROJECT", os.getenv("PROJECT_ID", "emulator-test-project"), + "GOOGLE_CLOUD_PROJECT", + os.getenv("PROJECT_ID", "emulator-test-project"), ) db_url = ( f"spanner+spanner:///projects/{project}/instances/" diff --git a/samples/conftest.py b/samples/conftest.py index 5a4f622e..298d8160 100644 --- a/samples/conftest.py +++ b/samples/conftest.py @@ -33,7 +33,8 @@ @pytest.fixture def db_url(): project = os.getenv( - "GOOGLE_CLOUD_PROJECT", os.getenv("PROJECT_ID", "emulator-test-project"), + "GOOGLE_CLOUD_PROJECT", + os.getenv("PROJECT_ID", "emulator-test-project"), ) db_url = ( f"spanner:///projects/{project}/instances/" diff --git a/test/_helpers.py b/test/_helpers.py index dd18a149..8ef795f2 100644 --- a/test/_helpers.py +++ b/test/_helpers.py @@ -32,7 +32,8 @@ PROJECT = os.getenv( - "GOOGLE_CLOUD_PROJECT", os.getenv("PROJECT_ID", "emulator-test-project"), + "GOOGLE_CLOUD_PROJECT", + os.getenv("PROJECT_ID", "emulator-test-project"), ) DB_URL = ( f"spanner:///projects/{PROJECT}/instances/" diff --git a/test/benchmark.py b/test/benchmark.py index 0ff50ae5..0260ffc0 100644 --- a/test/benchmark.py +++ b/test/benchmark.py @@ -154,7 +154,7 @@ def __init__(self): self._many_rows = [] self._many_rows2 = [] birth_date = datetime.date(1998, 10, 6) - picture = base64.b64encode(u"123".encode()) + picture = base64.b64encode("123".encode()) for num in self._many_rows_ids: self._many_rows.append( { @@ -216,7 +216,9 @@ def __init__(self): super().__init__() self._engine = create_engine( "spanner:///projects/{project}/instances/{instance}/databases/{db}".format( - project=PROJECT, instance=INSTANCE, db=DATABASE, + project=PROJECT, + instance=INSTANCE, + db=DATABASE, ) ) metadata = MetaData(bind=self._engine) @@ -260,13 +262,15 @@ def insert_one_row_with_fetch_after(self): @measure_execution_time def insert_many_rows(self): self._conn.execute( - self._table.insert(), self._many_rows, + self._table.insert(), + self._many_rows, ) @measure_execution_time def insert_many_rows_with_mutations(self): self._conn.execute( - self._table.insert(), self._many_rows2, + self._table.insert(), + self._many_rows2, ) @measure_execution_time diff --git a/test/test_suite_13.py b/test/test_suite_13.py index b53045ac..7b53b82c 100644 --- a/test/test_suite_13.py +++ b/test/test_suite_13.py @@ -793,7 +793,10 @@ def _test_get_unique_constraints(self, schema=None): reflected_metadata = MetaData() reflected = Table( - "testtbl", reflected_metadata, autoload_with=orig_meta.bind, schema=schema, + "testtbl", + reflected_metadata, + autoload_with=orig_meta.bind, + schema=schema, ) # test "deduplicates for index" logic. MySQL and Oracle @@ -1079,7 +1082,9 @@ def test_render_literal_numeric(self): Overriding the test to avoid the same failure. """ self._literal_round_trip( - Numeric(precision=8, scale=4), [15.7563], [decimal.Decimal("15.7563")], + Numeric(precision=8, scale=4), + [15.7563], + [decimal.Decimal("15.7563")], ) self._literal_round_trip( Numeric(precision=8, scale=4), @@ -1098,7 +1103,9 @@ def test_render_literal_numeric_asfloat(self): Overriding the test to avoid the same failure. """ self._literal_round_trip( - Numeric(precision=8, scale=4, asdecimal=False), [15.7563], [15.7563], + Numeric(precision=8, scale=4, asdecimal=False), + [15.7563], + [15.7563], ) self._literal_round_trip( Numeric(precision=8, scale=4, asdecimal=False), @@ -1193,7 +1200,9 @@ def test_float_as_decimal(self): Overriding the test to avoid the same failure. """ self._do_test( - Float(precision=8, asdecimal=True), [15.7563], [decimal.Decimal("15.7563")], + Float(precision=8, asdecimal=True), + [15.7563], + [decimal.Decimal("15.7563")], ) self._do_test( @@ -1742,7 +1751,9 @@ def define_tables(cls, metadata): if testing.requires.computed_columns_stored.enabled: t.append_column( Column( - "computed_stored", Integer, Computed("normal - 42", persisted=True), + "computed_stored", + Integer, + Computed("normal - 42", persisted=True), ) ) if testing.requires.schemas.enabled: diff --git a/test/unit/test_opentelemetry_tracing.py b/test/unit/test_opentelemetry_tracing.py index e762f93d..1f40f370 100644 --- a/test/unit/test_opentelemetry_tracing.py +++ b/test/unit/test_opentelemetry_tracing.py @@ -96,7 +96,8 @@ def test_trace_error(self): with pytest.raises(GoogleAPICallError): with _opentelemetry_tracing.trace_call( - "CloudSpannerSqlAlchemy.Test", extra_attributes, + "CloudSpannerSqlAlchemy.Test", + extra_attributes, ) as span: from google.api_core.exceptions import InvalidArgument From bc7bd45b2ed8c63a852f10bcef53a3511d17634d Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Tue, 17 May 2022 14:45:19 -0700 Subject: [PATCH 05/27] fix: reformat --- test/test_suite_14.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/test/test_suite_14.py b/test/test_suite_14.py index 688d822e..6d708f08 100644 --- a/test/test_suite_14.py +++ b/test/test_suite_14.py @@ -530,7 +530,9 @@ def test_reflect_bytes_column_max_len(self): """ metadata = MetaData(self.bind) Table( - "bytes_table", metadata, Column("TestColumn", LargeBinary, nullable=False), + "bytes_table", + metadata, + Column("TestColumn", LargeBinary, nullable=False), ) metadata.create_all() @@ -600,7 +602,10 @@ def test_get_unique_constraints(self, metadata, connection, use_schema): reflected_metadata = MetaData() reflected = Table( - "testtbl", reflected_metadata, autoload_with=connection, schema=schema, + "testtbl", + reflected_metadata, + autoload_with=connection, + schema=schema, ) # test "deduplicates for index" logic. MySQL and Oracle @@ -964,7 +969,9 @@ def test_limit_render_multiple_times(self, connection): u = union(select(stmt), select(stmt)).subquery().select() self._assert_result( - connection, u, [(2,)], + connection, + u, + [(2,)], ) @@ -1939,7 +1946,9 @@ def define_tables(cls, metadata): if testing.requires.computed_columns_stored.enabled: t.append_column( Column( - "computed_stored", Integer, Computed("normal - 42", persisted=True), + "computed_stored", + Integer, + Computed("normal - 42", persisted=True), ) ) @@ -1960,11 +1969,17 @@ def test_get_column_returns_persisted_with_schema(self): ) if testing.requires.computed_columns_virtual.enabled: self.check_column( - data, "computed_virtual", "normal/2", False, + data, + "computed_virtual", + "normal/2", + False, ) if testing.requires.computed_columns_stored.enabled: self.check_column( - data, "computed_stored", "normal-42", True, + data, + "computed_stored", + "normal-42", + True, ) @pytest.mark.skip("Default values are not supported.") From 02b9cb72d94d67e82dee9fa007681963dbcc1e47 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Wed, 18 May 2022 11:40:11 -0700 Subject: [PATCH 06/27] test: fix wrong folder name --- noxfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/noxfile.py b/noxfile.py index a54a9907..08fbcbf7 100644 --- a/noxfile.py +++ b/noxfile.py @@ -147,7 +147,7 @@ def compliance_test_13(session): session.run( "py.test", "--cov=google.cloud.sqlalchemy_spanner", - "--cov=tests", + "--cov=test", "--cov-append", "--cov-config=.coveragerc", "--cov-report=", @@ -187,7 +187,7 @@ def compliance_test_14(session): session.run( "py.test", "--cov=google.cloud.sqlalchemy_spanner", - "--cov=tests", + "--cov=test", "--cov-append", "--cov-config=.coveragerc", "--cov-report=", From 4f4adc4065e0c09edab01addb133695ae08de7a6 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Wed, 18 May 2022 12:11:45 -0700 Subject: [PATCH 07/27] test: fix setup conf --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index fd3202c4..519e3a14 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,7 @@ [tool:pytest] addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings -python_files=test/*test_*.py +python_files=test/test_*.py [sqla_testing] requirement_cls=google.cloud.sqlalchemy_spanner.requirements:Requirements From aeccaecfba0374dc8e07f726fd093f1215e7d1ea Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Wed, 18 May 2022 12:16:16 -0700 Subject: [PATCH 08/27] test: fix test name conventions --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index 519e3a14..8d2ca713 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,6 +17,7 @@ [tool:pytest] addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings python_files=test/test_*.py +python_classes=*Test [sqla_testing] requirement_cls=google.cloud.sqlalchemy_spanner.requirements:Requirements From 5354274c07d519fbd9543103cb8afeb00720100f Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Wed, 18 May 2022 12:18:29 -0700 Subject: [PATCH 09/27] test: fix conventions --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index 8d2ca713..1e27bcd8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,6 +18,7 @@ addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings python_files=test/test_*.py python_classes=*Test +python_functions = test_* [sqla_testing] requirement_cls=google.cloud.sqlalchemy_spanner.requirements:Requirements From 1d535657ecfed018535b8bc8d4a0f97a739e0453 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Wed, 18 May 2022 12:42:25 -0700 Subject: [PATCH 10/27] test: fix conventions --- setup.cfg | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 1e27bcd8..c931edb7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,9 +16,6 @@ [tool:pytest] addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings -python_files=test/test_*.py -python_classes=*Test -python_functions = test_* [sqla_testing] requirement_cls=google.cloud.sqlalchemy_spanner.requirements:Requirements From 6f9d8c947126e13d7cdf683f0ca1dfd2f10fed6e Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Wed, 18 May 2022 12:49:35 -0700 Subject: [PATCH 11/27] fix --- setup.cfg | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.cfg b/setup.cfg index c931edb7..b75074fe 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,6 +16,9 @@ [tool:pytest] addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings +python_files=test/test_*.py +python_classes=*Test* +python_functions = *test* [sqla_testing] requirement_cls=google.cloud.sqlalchemy_spanner.requirements:Requirements From 8ec22cde279c3712a9a1fe0eafaf5ff9d9c08923 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Wed, 18 May 2022 12:58:13 -0700 Subject: [PATCH 12/27] fix --- setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index b75074fe..50bc7fb8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,7 +18,6 @@ addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings python_files=test/test_*.py python_classes=*Test* -python_functions = *test* [sqla_testing] requirement_cls=google.cloud.sqlalchemy_spanner.requirements:Requirements From 35f2328fe0d99915251a9700e91b3a976d8db162 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Wed, 18 May 2022 13:09:55 -0700 Subject: [PATCH 13/27] fix --- setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 50bc7fb8..519e3a14 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,7 +17,6 @@ [tool:pytest] addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings python_files=test/test_*.py -python_classes=*Test* [sqla_testing] requirement_cls=google.cloud.sqlalchemy_spanner.requirements:Requirements From 43a73f10b23ffcc166b3449a4516289f3130cd67 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Wed, 18 May 2022 13:12:06 -0700 Subject: [PATCH 14/27] fix --- setup.cfg | 1 + test/unit/test_opentelemetry_tracing.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 519e3a14..8d2ca713 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,6 +17,7 @@ [tool:pytest] addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings python_files=test/test_*.py +python_classes=*Test [sqla_testing] requirement_cls=google.cloud.sqlalchemy_spanner.requirements:Requirements diff --git a/test/unit/test_opentelemetry_tracing.py b/test/unit/test_opentelemetry_tracing.py index 1f40f370..a8af61c6 100644 --- a/test/unit/test_opentelemetry_tracing.py +++ b/test/unit/test_opentelemetry_tracing.py @@ -32,7 +32,7 @@ def _make_rpc_error(error_cls, trailing_metadata=None): # Skip all of these tests if we don't have OpenTelemetry if HAS_OPENTELEMETRY_INSTALLED: - class TestNoTracing(OpenTelemetryBase): + class NoTracingTest(OpenTelemetryBase): def setup(self): self._temp_opentelemetry = sys.modules["opentelemetry"] @@ -47,7 +47,7 @@ def test_no_trace_call(self): with _opentelemetry_tracing.trace_call("Test") as no_span: assert no_span is None - class TestTracing(OpenTelemetryBase): + class TracingTest(OpenTelemetryBase): def test_trace_call(self): extra_attributes = { "attribute1": "value1", From 3cf30cd01f82c90d7834d0b230c0f8b53692b18d Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Wed, 18 May 2022 13:14:53 -0700 Subject: [PATCH 15/27] fix --- setup.cfg | 1 - test/unit/test_opentelemetry_tracing.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 8d2ca713..519e3a14 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,7 +17,6 @@ [tool:pytest] addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings python_files=test/test_*.py -python_classes=*Test [sqla_testing] requirement_cls=google.cloud.sqlalchemy_spanner.requirements:Requirements diff --git a/test/unit/test_opentelemetry_tracing.py b/test/unit/test_opentelemetry_tracing.py index a8af61c6..1f40f370 100644 --- a/test/unit/test_opentelemetry_tracing.py +++ b/test/unit/test_opentelemetry_tracing.py @@ -32,7 +32,7 @@ def _make_rpc_error(error_cls, trailing_metadata=None): # Skip all of these tests if we don't have OpenTelemetry if HAS_OPENTELEMETRY_INSTALLED: - class NoTracingTest(OpenTelemetryBase): + class TestNoTracing(OpenTelemetryBase): def setup(self): self._temp_opentelemetry = sys.modules["opentelemetry"] @@ -47,7 +47,7 @@ def test_no_trace_call(self): with _opentelemetry_tracing.trace_call("Test") as no_span: assert no_span is None - class TracingTest(OpenTelemetryBase): + class TestTracing(OpenTelemetryBase): def test_trace_call(self): extra_attributes = { "attribute1": "value1", From 9ac25bab2b1335a518c7ce351e875bc05a318dd1 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Wed, 18 May 2022 13:16:48 -0700 Subject: [PATCH 16/27] fix --- setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 519e3a14..c931edb7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,6 @@ [tool:pytest] addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings -python_files=test/test_*.py [sqla_testing] requirement_cls=google.cloud.sqlalchemy_spanner.requirements:Requirements From 8c8ec863046acfb0e825831d25bd2af7eb364bdf Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Wed, 18 May 2022 13:24:54 -0700 Subject: [PATCH 17/27] change name conventions --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index c931edb7..d0aeea56 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,6 +16,7 @@ [tool:pytest] addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings +python_classes=*Test* [sqla_testing] requirement_cls=google.cloud.sqlalchemy_spanner.requirements:Requirements From 0cf3ab50cc6e10114f7383d1e3c6959b1644cdae Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Wed, 18 May 2022 13:28:13 -0700 Subject: [PATCH 18/27] fix --- setup.cfg | 2 +- test/unit/test_opentelemetry_tracing.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index d0aeea56..4a1e77d2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,7 @@ [tool:pytest] addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings -python_classes=*Test* +python_classes=*Test [sqla_testing] requirement_cls=google.cloud.sqlalchemy_spanner.requirements:Requirements diff --git a/test/unit/test_opentelemetry_tracing.py b/test/unit/test_opentelemetry_tracing.py index 1f40f370..a8af61c6 100644 --- a/test/unit/test_opentelemetry_tracing.py +++ b/test/unit/test_opentelemetry_tracing.py @@ -32,7 +32,7 @@ def _make_rpc_error(error_cls, trailing_metadata=None): # Skip all of these tests if we don't have OpenTelemetry if HAS_OPENTELEMETRY_INSTALLED: - class TestNoTracing(OpenTelemetryBase): + class NoTracingTest(OpenTelemetryBase): def setup(self): self._temp_opentelemetry = sys.modules["opentelemetry"] @@ -47,7 +47,7 @@ def test_no_trace_call(self): with _opentelemetry_tracing.trace_call("Test") as no_span: assert no_span is None - class TestTracing(OpenTelemetryBase): + class TracingTest(OpenTelemetryBase): def test_trace_call(self): extra_attributes = { "attribute1": "value1", From 535bcadae12b9842a5dbbc94d3ec52f2dac20f03 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Wed, 18 May 2022 13:39:56 -0700 Subject: [PATCH 19/27] fix --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 4a1e77d2..566c6d57 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,7 @@ [tool:pytest] addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings -python_classes=*Test +python_classes=Test [sqla_testing] requirement_cls=google.cloud.sqlalchemy_spanner.requirements:Requirements From 47aa7ee0e510ca22b814fcede2064eb72ec658c8 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Wed, 18 May 2022 13:54:53 -0700 Subject: [PATCH 20/27] fix name convention --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 566c6d57..4a1e77d2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,7 @@ [tool:pytest] addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings -python_classes=Test +python_classes=*Test [sqla_testing] requirement_cls=google.cloud.sqlalchemy_spanner.requirements:Requirements From c9f4b3cc6bff30d8b3fb82f045649c073442fe35 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Mon, 23 May 2022 11:20:09 +0400 Subject: [PATCH 21/27] fix --- google/cloud/sqlalchemy_spanner/requirements.py | 1 + 1 file changed, 1 insertion(+) diff --git a/google/cloud/sqlalchemy_spanner/requirements.py b/google/cloud/sqlalchemy_spanner/requirements.py index d552dc34..ce5e8d53 100644 --- a/google/cloud/sqlalchemy_spanner/requirements.py +++ b/google/cloud/sqlalchemy_spanner/requirements.py @@ -29,6 +29,7 @@ def computed_columns(self): def computed_columns_stored(self): return exclusions.open() + @property def sane_rowcount(self): return exclusions.closed() From e1c0e08a077352fcda02668daa3466d1db05cdd3 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Mon, 23 May 2022 11:33:11 +0400 Subject: [PATCH 22/27] fix --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 08fbcbf7..7d6a667e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -141,7 +141,7 @@ def compliance_test_13(session): session.install("mock") session.install("-e", ".[tracing]") - session.run("pip", "install", "sqlalchemy>=1.1.13,<=1.3.23", "--force-reinstall") + session.install("sqlalchemy>=1.1.13,<1.4", "--force-reinstall") session.run("python", "create_test_database.py") session.run( From 1d8d293c0bea38945f5196c6d40e68d1aa851cc4 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Thu, 2 Jun 2022 11:50:49 +0400 Subject: [PATCH 23/27] test: use older package versions for SQLAlchemy 1.3 version --- noxfile.py | 5 ++++- setup.cfg | 2 +- setup.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index 7d6a667e..69a8317a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -141,7 +141,10 @@ def compliance_test_13(session): session.install("mock") session.install("-e", ".[tracing]") - session.install("sqlalchemy>=1.1.13,<1.4", "--force-reinstall") + session.run("pip", "install", "sqlalchemy>=1.1.13,<=1.3.24", "--force-reinstall") + session.run("pip", "install", "pytest==6.2.2", "--force-reinstall") + session.run("pip", "install", "opentelemetry-api<=1.10", "--force-reinstall") + session.run("pip", "install", "opentelemetry-sdk<=1.10", "--force-reinstall") session.run("python", "create_test_database.py") session.run( diff --git a/setup.cfg b/setup.cfg index 4a1e77d2..7414ed04 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,7 @@ [tool:pytest] addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings -python_classes=*Test +python_files=test_*.py [sqla_testing] requirement_cls=google.cloud.sqlalchemy_spanner.requirements:Requirements diff --git a/setup.py b/setup.py index 9f89d405..4096a7b1 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ name = "sqlalchemy-spanner" description = "SQLAlchemy dialect integrated into Cloud Spanner database" dependencies = [ - "sqlalchemy>=1.1.13", + "sqlalchemy>=1.1.13, <=1.3.24", "google-cloud-spanner>=3.12.0", "alembic", ] From da2ad35718b52ce846598350e5e48299e5b646a8 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Thu, 2 Jun 2022 12:16:59 +0400 Subject: [PATCH 24/27] fix --- setup.cfg | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 7414ed04..4a1e77d2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,7 @@ [tool:pytest] addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings -python_files=test_*.py +python_classes=*Test [sqla_testing] requirement_cls=google.cloud.sqlalchemy_spanner.requirements:Requirements diff --git a/setup.py b/setup.py index 4096a7b1..9f89d405 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ name = "sqlalchemy-spanner" description = "SQLAlchemy dialect integrated into Cloud Spanner database" dependencies = [ - "sqlalchemy>=1.1.13, <=1.3.24", + "sqlalchemy>=1.1.13", "google-cloud-spanner>=3.12.0", "alembic", ] From fd842ff301bfce041a4a8cca13918a714fb091e1 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Thu, 2 Jun 2022 19:42:05 +0400 Subject: [PATCH 25/27] fix --- google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py b/google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py index 9a1209b2..68a4a759 100644 --- a/google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py +++ b/google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py @@ -48,7 +48,9 @@ @listens_for(Pool, "reset") def reset_connection(dbapi_conn, connection_record): """An event of returning a connection back to a pool.""" - dbapi_conn.connection.rollback() + if not dbapi_conn.connection.inside_transaction: + dbapi_conn.connection.rollback() + if getattr(dbapi_conn.connection, "staleness", None) is not None: dbapi_conn.connection.staleness = None From 7eb267691a95c2377b387fd7fb0062a98de9daf6 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Thu, 2 Jun 2022 19:47:39 +0400 Subject: [PATCH 26/27] fix --- google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py b/google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py index 68a4a759..82eb14bd 100644 --- a/google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py +++ b/google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py @@ -48,7 +48,7 @@ @listens_for(Pool, "reset") def reset_connection(dbapi_conn, connection_record): """An event of returning a connection back to a pool.""" - if not dbapi_conn.connection.inside_transaction: + if dbapi_conn.connection.inside_transaction: dbapi_conn.connection.rollback() if getattr(dbapi_conn.connection, "staleness", None) is not None: From 4bae1e05bdd23d2038175cc278296eac7aa78f48 Mon Sep 17 00:00:00 2001 From: IlyaFaer Date: Fri, 3 Jun 2022 11:00:53 +0400 Subject: [PATCH 27/27] fix migration script --- noxfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 69a8317a..29d4f20c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -257,7 +257,9 @@ def migration_test(session): with open(files[0], "r") as f: script_code = f.read() - script_code = script_code.replace("""def upgrade():\n pass""", UPGRADE_CODE) + script_code = script_code.replace( + """def upgrade() -> None:\n pass""", UPGRADE_CODE + ) with open(files[0], "w") as f: f.write(script_code)