Skip to content

Commit 709c0d0

Browse files
committed
update with a new unit test
1 parent 43ac9e8 commit 709c0d0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

β€Žtests/unit/test_table_options.pyβ€Ž

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,23 @@ def test_table_time_partitioning_with_timestamp_dialect_option(faux_conn):
193193
)
194194

195195

196+
def test_table_time_partitioning_with_date_dialect_option(faux_conn):
197+
# expect table creation to fail as SQLite does not support partitioned tables
198+
with pytest.raises(sqlite3.OperationalError):
199+
setup_table(
200+
faux_conn,
201+
"some_table_2",
202+
sqlalchemy.Column("id", sqlalchemy.Integer),
203+
sqlalchemy.Column("createdAt", sqlalchemy.DATE),
204+
bigquery_time_partitioning=TimePartitioning(field="createdAt"),
205+
)
206+
# confirm that the following code creates the correct SQL string
207+
assert " ".join(faux_conn.test_data["execute"][-1][0].strip().split()) == (
208+
"CREATE TABLE `some_table_2` ( `id` INT64, `createdAt` DATE )"
209+
" PARTITION BY createdAt"
210+
)
211+
212+
196213
def test_table_time_partitioning_dialect_option_partition_expiration_days(faux_conn):
197214
# expect table creation to fail as SQLite does not support partitioned tables
198215
with pytest.raises(sqlite3.OperationalError):

0 commit comments

Comments
 (0)