From a8921d5ab963f8f8c1e77e9f6c6d9556206ca50b Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Wed, 29 Dec 2021 13:44:41 -0600 Subject: [PATCH 1/4] test: failing alembic test compares structured objects instead of strings --- tests/system/test_alembic.py | 40 ++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/tests/system/test_alembic.py b/tests/system/test_alembic.py index 81c686d1..31643b86 100644 --- a/tests/system/test_alembic.py +++ b/tests/system/test_alembic.py @@ -23,6 +23,7 @@ from sqlalchemy import Column, DateTime, Integer, String import google.api_core.exceptions +from google.cloud.bigquery import SchemaField alembic = pytest.importorskip("alembic") @@ -43,10 +44,7 @@ def get_table(table_name, data="table"): if data == "table": return table elif data == "schema": - return [ - repr(s).replace(", (), None)", ")").replace(", None)", ")") - for s in table.schema - ] + return table.schema else: raise ValueError(data) except google.api_core.exceptions.NotFound: @@ -78,9 +76,9 @@ def test_alembic_scenario(alembic_table): Column("description", String(200)), ) assert alembic_table("account", "schema") == [ - "SchemaField('id', 'INTEGER', 'REQUIRED', None, (), ())", - "SchemaField('name', 'STRING(50)', 'REQUIRED', 'The name', (), ())", - "SchemaField('description', 'STRING(200)', 'NULLABLE', None, (), ())", + SchemaField('id', 'INTEGER', 'REQUIRED'), + SchemaField('name', 'STRING(50)', 'REQUIRED', description='The name'), + SchemaField('description', 'STRING(200)'), ] op.bulk_insert( @@ -103,11 +101,10 @@ def test_alembic_scenario(alembic_table): ) assert alembic_table("account", "schema") == [ - "SchemaField('id', 'INTEGER', 'REQUIRED', None, (), ())", - "SchemaField('name', 'STRING(50)', 'REQUIRED', 'The name', (), ())", - "SchemaField('description', 'STRING(200)', 'NULLABLE', None, (), ())", - "SchemaField('last_transaction_date', 'DATETIME', 'NULLABLE', 'when updated'" - ", (), ())", + SchemaField('id', 'INTEGER', 'REQUIRED'), + SchemaField('name', 'STRING(50)', 'REQUIRED', description="The name"), + SchemaField('description', 'STRING(200)'), + SchemaField('last_transaction_date', 'DATETIME', description='when updated'), ] op.create_table( @@ -123,8 +120,8 @@ def test_alembic_scenario(alembic_table): op.drop_column("account_w_comment", "description") assert alembic_table("account_w_comment", "schema") == [ - "SchemaField('id', 'INTEGER', 'REQUIRED', None, (), ())", - "SchemaField('name', 'STRING(50)', 'REQUIRED', 'The name', (), ())", + SchemaField('id', 'INTEGER', 'REQUIRED'), + SchemaField('name', 'STRING(50)', 'REQUIRED', description='The name'), ] op.drop_table("account_w_comment") @@ -133,11 +130,10 @@ def test_alembic_scenario(alembic_table): op.rename_table("account", "accounts") assert alembic_table("account") is None assert alembic_table("accounts", "schema") == [ - "SchemaField('id', 'INTEGER', 'REQUIRED', None, (), ())", - "SchemaField('name', 'STRING(50)', 'REQUIRED', 'The name', (), ())", - "SchemaField('description', 'STRING(200)', 'NULLABLE', None, (), ())", - "SchemaField('last_transaction_date', 'DATETIME', 'NULLABLE', 'when updated'" - ", (), ())", + SchemaField('id', 'INTEGER', 'REQUIRED'), + SchemaField('name', 'STRING(50)', 'REQUIRED', description='The name'), + SchemaField('description', 'STRING(200)'), + SchemaField('last_transaction_date', 'DATETIME', description='when updated'), ] op.drop_table("accounts") assert alembic_table("accounts") is None @@ -157,9 +153,9 @@ def test_alembic_scenario(alembic_table): # nullable: op.alter_column("transactions", "amount", True) assert alembic_table("transactions", "schema") == [ - "SchemaField('account', 'INTEGER', 'REQUIRED', None, (), ())", - "SchemaField('transaction_time', 'DATETIME', 'REQUIRED', None, (), ())", - "SchemaField('amount', 'NUMERIC(11, 2)', 'NULLABLE', None, (), ())", + SchemaField('account', 'INTEGER', 'REQUIRED'), + SchemaField('transaction_time', 'DATETIME', 'REQUIRED'), + SchemaField('amount', 'NUMERIC(11, 2)'), ] op.create_table_comment("transactions", "Transaction log") From 6831b1d6489aabc7dad3a6b9dcc80451fe483eb0 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 29 Dec 2021 19:47:12 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot?= 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 --- tests/system/test_alembic.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/system/test_alembic.py b/tests/system/test_alembic.py index 31643b86..6c4736c8 100644 --- a/tests/system/test_alembic.py +++ b/tests/system/test_alembic.py @@ -76,9 +76,9 @@ def test_alembic_scenario(alembic_table): Column("description", String(200)), ) assert alembic_table("account", "schema") == [ - SchemaField('id', 'INTEGER', 'REQUIRED'), - SchemaField('name', 'STRING(50)', 'REQUIRED', description='The name'), - SchemaField('description', 'STRING(200)'), + SchemaField("id", "INTEGER", "REQUIRED"), + SchemaField("name", "STRING(50)", "REQUIRED", description="The name"), + SchemaField("description", "STRING(200)"), ] op.bulk_insert( @@ -101,10 +101,10 @@ def test_alembic_scenario(alembic_table): ) assert alembic_table("account", "schema") == [ - SchemaField('id', 'INTEGER', 'REQUIRED'), - SchemaField('name', 'STRING(50)', 'REQUIRED', description="The name"), - SchemaField('description', 'STRING(200)'), - SchemaField('last_transaction_date', 'DATETIME', description='when updated'), + SchemaField("id", "INTEGER", "REQUIRED"), + SchemaField("name", "STRING(50)", "REQUIRED", description="The name"), + SchemaField("description", "STRING(200)"), + SchemaField("last_transaction_date", "DATETIME", description="when updated"), ] op.create_table( @@ -120,8 +120,8 @@ def test_alembic_scenario(alembic_table): op.drop_column("account_w_comment", "description") assert alembic_table("account_w_comment", "schema") == [ - SchemaField('id', 'INTEGER', 'REQUIRED'), - SchemaField('name', 'STRING(50)', 'REQUIRED', description='The name'), + SchemaField("id", "INTEGER", "REQUIRED"), + SchemaField("name", "STRING(50)", "REQUIRED", description="The name"), ] op.drop_table("account_w_comment") @@ -130,10 +130,10 @@ def test_alembic_scenario(alembic_table): op.rename_table("account", "accounts") assert alembic_table("account") is None assert alembic_table("accounts", "schema") == [ - SchemaField('id', 'INTEGER', 'REQUIRED'), - SchemaField('name', 'STRING(50)', 'REQUIRED', description='The name'), - SchemaField('description', 'STRING(200)'), - SchemaField('last_transaction_date', 'DATETIME', description='when updated'), + SchemaField("id", "INTEGER", "REQUIRED"), + SchemaField("name", "STRING(50)", "REQUIRED", description="The name"), + SchemaField("description", "STRING(200)"), + SchemaField("last_transaction_date", "DATETIME", description="when updated"), ] op.drop_table("accounts") assert alembic_table("accounts") is None @@ -153,9 +153,9 @@ def test_alembic_scenario(alembic_table): # nullable: op.alter_column("transactions", "amount", True) assert alembic_table("transactions", "schema") == [ - SchemaField('account', 'INTEGER', 'REQUIRED'), - SchemaField('transaction_time', 'DATETIME', 'REQUIRED'), - SchemaField('amount', 'NUMERIC(11, 2)'), + SchemaField("account", "INTEGER", "REQUIRED"), + SchemaField("transaction_time", "DATETIME", "REQUIRED"), + SchemaField("amount", "NUMERIC(11, 2)"), ] op.create_table_comment("transactions", "Transaction log") From f32d900d5def92b8da7fb9829f11adaab5d12ca7 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Wed, 29 Dec 2021 18:16:48 -0600 Subject: [PATCH 3/4] temporarily cap max sqlalchemy while we debug failing compliance tests --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7efe0f9b..5f1d465b 100644 --- a/setup.py +++ b/setup.py @@ -84,7 +84,7 @@ def readme(): # https://github.com/googleapis/google-cloud-python/issues/10566 "google-auth>=1.25.0,<3.0.0dev", # Work around pip wack. "google-cloud-bigquery>=2.25.2,<3.0.0dev", - "sqlalchemy>=1.2.0,<1.5.0dev", + "sqlalchemy>=1.2.0,<=1.4.25", "future", ], extras_require=extras, From 878128bc8109a6b9e4a3a4db4c6b450083e09d5b Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Wed, 29 Dec 2021 18:19:37 -0600 Subject: [PATCH 4/4] document pin --- setup.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setup.py b/setup.py index 5f1d465b..7c081c01 100644 --- a/setup.py +++ b/setup.py @@ -84,6 +84,11 @@ def readme(): # https://github.com/googleapis/google-cloud-python/issues/10566 "google-auth>=1.25.0,<3.0.0dev", # Work around pip wack. "google-cloud-bigquery>=2.25.2,<3.0.0dev", + # Temporarily set maximimum sqlalchemy to a known-working version while + # we debug failing compliance tests. See: + # https://github.com/googleapis/python-bigquery-sqlalchemy/issues/386 + # and + # https://github.com/googleapis/python-bigquery-sqlalchemy/issues/385 "sqlalchemy>=1.2.0,<=1.4.25", "future", ],