diff --git a/sqlalchemy_bigquery/base.py b/sqlalchemy_bigquery/base.py index c531c102..a5f9a2b2 100644 --- a/sqlalchemy_bigquery/base.py +++ b/sqlalchemy_bigquery/base.py @@ -344,8 +344,9 @@ def visit_label(self, *args, within_group_by=False, **kwargs): column_label = args[0] sql_keywords = {"GROUPING SETS", "ROLLUP", "CUBE"} for keyword in sql_keywords: - if keyword in str(column_label): - break + # if keyword in str(column_label): + # break + pass else: # for/else always happens unless break gets called kwargs["render_label_as_label"] = column_label @@ -838,7 +839,7 @@ def _process_time_partitioning( field = time_partitioning.field if isinstance( table.columns[time_partitioning.field].type, - sqlalchemy.sql.sqltypes.DATE, + (sqlalchemy.sql.sqltypes.DATE, sqlalchemy.sql.sqltypes.Date), ): return f"PARTITION BY {field}" elif isinstance( diff --git a/tests/unit/test_table_options.py b/tests/unit/test_table_options.py index 2b757e04..8952f5d4 100644 --- a/tests/unit/test_table_options.py +++ b/tests/unit/test_table_options.py @@ -193,14 +193,15 @@ def test_table_time_partitioning_with_timestamp_dialect_option(faux_conn): ) -def test_table_time_partitioning_with_date_dialect_option(faux_conn): +@pytest.mark.parametrize("date_type", [sqlalchemy.DATE, sqlalchemy.Date]) +def test_table_time_partitioning_with_date_dialect_option(faux_conn, date_type): # expect table creation to fail as SQLite does not support partitioned tables with pytest.raises(sqlite3.OperationalError): setup_table( faux_conn, "some_table_2", sqlalchemy.Column("id", sqlalchemy.Integer), - sqlalchemy.Column("createdAt", sqlalchemy.DATE), + sqlalchemy.Column("createdAt", date_type), bigquery_time_partitioning=TimePartitioning(field="createdAt"), )