From 5503877901f86a7a52cd1057c13ef8fa5ba5c575 Mon Sep 17 00:00:00 2001 From: kiraksi Date: Wed, 10 Jan 2024 14:19:56 -0800 Subject: [PATCH 1/7] Updated docs --- README.rst | 2 +- sqlalchemy_bigquery/test.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 sqlalchemy_bigquery/test.py diff --git a/README.rst b/README.rst index 123f2106..286821d2 100644 --- a/README.rst +++ b/README.rst @@ -36,7 +36,7 @@ In order to use this library, you first need to go through the following steps: .. note:: This library is a prerelease to gauge compatiblity with SQLAlchemy - versions >= 2.0.0 + versions >= 1.4.16 < 2.1 Installation ------------ diff --git a/sqlalchemy_bigquery/test.py b/sqlalchemy_bigquery/test.py new file mode 100644 index 00000000..c7a3ed6a --- /dev/null +++ b/sqlalchemy_bigquery/test.py @@ -0,0 +1,6 @@ +from sqlalchemy.sql.expression import cast +from sqlalchemy import String, func +code_coding = db.query(func.unnest(self.model.code_coding)).subquery() +conditions.append( + and_(cast(code_coding.c.code, String) == "H", cast(code_coding.c.display, String) == "BLAST") +) \ No newline at end of file From b4010e11304af97a7293b12dfacbdeeab43fc6e6 Mon Sep 17 00:00:00 2001 From: kiraksi Date: Fri, 12 Jan 2024 01:42:56 -0800 Subject: [PATCH 2/7] minor fixes to noxfile and README --- README.rst | 2 +- noxfile.py | 5 ----- samples/snippets/requirements.txt | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index 286821d2..b6693abb 100644 --- a/README.rst +++ b/README.rst @@ -36,7 +36,7 @@ In order to use this library, you first need to go through the following steps: .. note:: This library is a prerelease to gauge compatiblity with SQLAlchemy - versions >= 1.4.16 < 2.1 + versions >= 1.4.16 and < 2.1 Installation ------------ diff --git a/noxfile.py b/noxfile.py index 5a5ed906..c2600f52 100644 --- a/noxfile.py +++ b/noxfile.py @@ -213,8 +213,6 @@ def default(session, install_extras=True): install_target = "." session.install("-e", install_target, "-c", constraints_path) - session.run("python", "-m", "pip", "freeze") - # Run py.test against the unit tests. session.run( "py.test", @@ -419,8 +417,6 @@ def cover(session): """ session.install("coverage", "pytest-cov") - session.run("python", "-m", "pip", "freeze") - session.run("coverage", "report", "--show-missing", "--fail-under=100") session.run("coverage", "erase") @@ -552,7 +548,6 @@ def prerelease_deps(session): "requests", ] session.install(*other_deps) - session.run("python", "-m", "pip", "freeze") # Print out prerelease package versions session.run( diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index ffb51928..f011f19c 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -28,6 +28,6 @@ requests==2.31.0 rsa==4.9 shapely==2.0.2 six==1.16.0 -sqlalchemy===1.4.15 +sqlalchemy==1.4.16 typing-extensions==4.9.0 urllib3==2.1.0 From b11a11070f6e6fedfe03cf664da5a7664cec094e Mon Sep 17 00:00:00 2001 From: Lingqing Gan Date: Fri, 12 Jan 2024 08:03:21 -0800 Subject: [PATCH 3/7] test: change compliance test rerun condition regex string (#982) * test: change compliance test rerun condition regex string * try sys test * add sleep to time * change exceed rate limit code to 400 * change rerun condition format * delete compliance tests to make it faster * stop on first fail * add rerun condition * change rerun condition format * add back the deleted tests * remove investigation changes and add owlbot change * black * revert README --- noxfile.py | 9 +++++---- owlbot.py | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/noxfile.py b/noxfile.py index e31f32c5..82fa27d5 100644 --- a/noxfile.py +++ b/noxfile.py @@ -394,10 +394,11 @@ def compliance(session): f"--junitxml=compliance_{session.python}_sponge_log.xml", "--reruns=3", "--reruns-delay=60", - "--only-rerun=403 Exceeded rate limits", - "--only-rerun=409 Already Exists", - "--only-rerun=404 Not found", - "--only-rerun=400 Cannot execute DML over a non-existent table", + "--only-rerun=Exceeded rate limits", + "--only-rerun=Already Exists", + "--only-rerun=Not found", + "--only-rerun=Cannot execute DML over a non-existent table", + "--only-rerun=Job exceeded rate limits", system_test_folder_path, *session.posargs, # To suppress the "Deprecated API features detected!" warning when diff --git a/owlbot.py b/owlbot.py index 22678c8b..8c3ce732 100644 --- a/owlbot.py +++ b/owlbot.py @@ -188,10 +188,11 @@ def compliance(session): f"--junitxml=compliance_{session.python}_sponge_log.xml", "--reruns=3", "--reruns-delay=60", - "--only-rerun=403 Exceeded rate limits", - "--only-rerun=409 Already Exists", - "--only-rerun=404 Not found", - "--only-rerun=400 Cannot execute DML over a non-existent table", + "--only-rerun=Exceeded rate limits", + "--only-rerun=Already Exists", + "--only-rerun=Not found", + "--only-rerun=Cannot execute DML over a non-existent table", + "--only-rerun=Job exceeded rate limits", system_test_folder_path, *session.posargs, # To suppress the "Deprecated API features detected!" warning when From 1e54e77869a8584f95cc0266853ceadbd20a6443 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 16 Jan 2024 15:38:57 +0000 Subject: [PATCH 4/7] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- noxfile.py | 1 - sqlalchemy_bigquery/test.py | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index 1e1808ab..41666055 100644 --- a/noxfile.py +++ b/noxfile.py @@ -417,7 +417,6 @@ def cover(session): test runs (not system test runs), and then erases coverage data. """ session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=100") session.run("coverage", "erase") diff --git a/sqlalchemy_bigquery/test.py b/sqlalchemy_bigquery/test.py index c7a3ed6a..6c7156fb 100644 --- a/sqlalchemy_bigquery/test.py +++ b/sqlalchemy_bigquery/test.py @@ -1,6 +1,10 @@ from sqlalchemy.sql.expression import cast from sqlalchemy import String, func + code_coding = db.query(func.unnest(self.model.code_coding)).subquery() conditions.append( - and_(cast(code_coding.c.code, String) == "H", cast(code_coding.c.display, String) == "BLAST") -) \ No newline at end of file + and_( + cast(code_coding.c.code, String) == "H", + cast(code_coding.c.display, String) == "BLAST", + ) +) From e95aee1d0ea45f6b0d98de268d30abba3eb9073f Mon Sep 17 00:00:00 2001 From: kiraksi Date: Wed, 17 Jan 2024 03:39:18 -0800 Subject: [PATCH 5/7] cleaned up code from review, removed unnecessary code and files --- sqlalchemy_bigquery/test.py | 10 ---------- .../test_dialect_compliance.py | 8 -------- tests/system/test_sqlalchemy_bigquery.py | 5 ----- 3 files changed, 23 deletions(-) delete mode 100644 sqlalchemy_bigquery/test.py diff --git a/sqlalchemy_bigquery/test.py b/sqlalchemy_bigquery/test.py deleted file mode 100644 index 6c7156fb..00000000 --- a/sqlalchemy_bigquery/test.py +++ /dev/null @@ -1,10 +0,0 @@ -from sqlalchemy.sql.expression import cast -from sqlalchemy import String, func - -code_coding = db.query(func.unnest(self.model.code_coding)).subquery() -conditions.append( - and_( - cast(code_coding.c.code, String) == "H", - cast(code_coding.c.display, String) == "BLAST", - ) -) diff --git a/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py b/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py index a8ba194c..822ad1f8 100644 --- a/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py +++ b/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py @@ -85,8 +85,6 @@ def literal(value, type_=None): if type_ is not None: assert type_ is self.datatype - import sqlalchemy.sql.sqltypes - return sqlalchemy.sql.elements.literal(value, self.datatype) with mock.patch("sqlalchemy.testing.suite.test_types.literal", literal): @@ -127,7 +125,6 @@ def test_update(self): # Had to pass in data as a dict object in 2.0 r = connection.execute(t.update().where(t.c.id == 2), dict(data="d2_new")) assert not r.is_insert - # assert not r.returns_rows eq_( connection.execute(t.select().order_by(t.c.id)).fetchall(), @@ -139,7 +136,6 @@ def test_delete(self): connection = config.db.connect() r = connection.execute(t.delete().where(t.c.id == 2)) assert not r.is_insert - # assert not r.returns_rows eq_( connection.execute(t.select().order_by(t.c.id)).fetchall(), [(1, "d1"), (3, "d3")], @@ -526,7 +522,6 @@ def test_update(self): t = self.tables.plain_pk r = config.db.execute(t.update().where(t.c.id == 2), data="d2_new") assert not r.is_insert - # assert not r.returns_rows eq_( config.db.execute(t.select().order_by(t.c.id)).fetchall(), @@ -537,7 +532,6 @@ def test_delete(self): t = self.tables.plain_pk r = config.db.execute(t.delete().where(t.c.id == 2)) assert not r.is_insert - # assert not r.returns_rows eq_( config.db.execute(t.select().order_by(t.c.id)).fetchall(), [(1, "d1"), (3, "d3")], @@ -671,7 +665,6 @@ def test_update(self): t = self.tables.plain_pk r = config.db.execute(t.update().where(t.c.id == 2), data="d2_new") assert not r.is_insert - # assert not r.returns_rows eq_( config.db.execute(t.select().order_by(t.c.id)).fetchall(), @@ -682,7 +675,6 @@ def test_delete(self): t = self.tables.plain_pk r = config.db.execute(t.delete().where(t.c.id == 2)) assert not r.is_insert - # assert not r.returns_rows eq_( config.db.execute(t.select().order_by(t.c.id)).fetchall(), [(1, "d1"), (3, "d3")], diff --git a/tests/system/test_sqlalchemy_bigquery.py b/tests/system/test_sqlalchemy_bigquery.py index 906f4326..457a8ea8 100644 --- a/tests/system/test_sqlalchemy_bigquery.py +++ b/tests/system/test_sqlalchemy_bigquery.py @@ -286,11 +286,6 @@ def test_reflect_select(table, engine_using_test_dataset, table_using_test_datas assert isinstance(table.c["nested_record.record.name"].type, types.String) assert isinstance(table.c.array.type, types.ARRAY) - # Force unique column labels using `use_labels` below to deal - # with BQ sometimes complaining about duplicate column names - # when a destination table is specified, even though no - # destination table is specified. When this test was written, - # `use_labels` was forced by the dialect. with engine_using_test_dataset.connect() as conn: rows = conn.execute( table.select().set_label_style( From fcd575510f4bd24796e7cb208c552a2cf06fbe22 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 17 Jan 2024 10:37:31 -0500 Subject: [PATCH 6/7] build(python): fix `docs` and `docfx` builds (#1006) Source-Link: https://github.com/googleapis/synthtool/commit/fac8444edd5f5526e804c306b766a271772a3e2f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5ea6d0ab82c956b50962f91d94e206d3921537ae5fe1549ec5326381d8905cfa Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 6 +++--- .kokoro/requirements.txt | 6 +++--- noxfile.py | 20 +++++++++++++++++++- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 40bf9973..d8a1bbca 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,4 +1,4 @@ -# Copyright 2023 Google LLC +# Copyright 2024 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:230f7fe8a0d2ed81a519cfc15c6bb11c5b46b9fb449b8b1219b3771bcb520ad2 -# created: 2023-12-09T15:16:25.430769578Z + digest: sha256:5ea6d0ab82c956b50962f91d94e206d3921537ae5fe1549ec5326381d8905cfa +# created: 2024-01-15T16:32:08.142785673Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index e5c1ffca..bb3d6ca3 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -263,9 +263,9 @@ jeepney==0.8.0 \ # via # keyring # secretstorage -jinja2==3.1.2 \ - --hash=sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852 \ - --hash=sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61 +jinja2==3.1.3 \ + --hash=sha256:7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa \ + --hash=sha256:ac8bd6544d4bb2c9792bf3a159e80bba8fda7f07e81bc3aed565432d5925ba90 # via gcp-releasetool keyring==24.2.0 \ --hash=sha256:4901caaf597bfd3bbd78c9a0c7c4c29fcd8310dab2cffefe749e916b6527acd6 \ diff --git a/noxfile.py b/noxfile.py index 82fa27d5..28f000db 100644 --- a/noxfile.py +++ b/noxfile.py @@ -428,7 +428,16 @@ def docs(session): session.install("-e", ".") session.install( - "sphinx==4.0.1", + # We need to pin to specific versions of the `sphinxcontrib-*` packages + # which still support sphinx 4.x. + # See https://github.com/googleapis/sphinx-docfx-yaml/issues/344 + # and https://github.com/googleapis/sphinx-docfx-yaml/issues/345. + "sphinxcontrib-applehelp==1.0.4", + "sphinxcontrib-devhelp==1.0.2", + "sphinxcontrib-htmlhelp==2.0.1", + "sphinxcontrib-qthelp==1.0.3", + "sphinxcontrib-serializinghtml==1.1.5", + "sphinx==4.5.0", "alabaster", "geoalchemy2", "shapely", @@ -456,6 +465,15 @@ def docfx(session): session.install("-e", ".") session.install( + # We need to pin to specific versions of the `sphinxcontrib-*` packages + # which still support sphinx 4.x. + # See https://github.com/googleapis/sphinx-docfx-yaml/issues/344 + # and https://github.com/googleapis/sphinx-docfx-yaml/issues/345. + "sphinxcontrib-applehelp==1.0.4", + "sphinxcontrib-devhelp==1.0.2", + "sphinxcontrib-htmlhelp==2.0.1", + "sphinxcontrib-qthelp==1.0.3", + "sphinxcontrib-serializinghtml==1.1.5", "gcp-sphinx-docfx-yaml", "alabaster", "geoalchemy2", From b8f8f2133becb3cb43f373939c86dbd03e9a5975 Mon Sep 17 00:00:00 2001 From: Chalmer Lowe Date: Wed, 17 Jan 2024 11:47:07 -0500 Subject: [PATCH 7/7] Update tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py --- tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py b/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py index 822ad1f8..7677510e 100644 --- a/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py +++ b/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py @@ -122,7 +122,7 @@ class SimpleUpdateDeleteTest(_SimpleUpdateDeleteTest): def test_update(self): t = self.tables.plain_pk connection = config.db.connect() - # Had to pass in data as a dict object in 2.0 + # In SQLAlchemy 2.0, the datatype changed to dict in the following function. r = connection.execute(t.update().where(t.c.id == 2), dict(data="d2_new")) assert not r.is_insert