diff --git a/setup.py b/setup.py index 7efe0f9b..7c081c01 100644 --- a/setup.py +++ b/setup.py @@ -84,7 +84,12 @@ 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", + # 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", ], extras_require=extras, diff --git a/tests/system/test_alembic.py b/tests/system/test_alembic.py index 81c686d1..6c4736c8 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")