Skip to content

Commit e0e7799

Browse files
Drop the S3 Tables test table even if CREATE fails, and assert it is listed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 2ca3829 commit e0e7799

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

‎tests/pyathena/test_glue.py‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,23 @@ def test_reads_s3_tables_catalog(self):
7070
connect(schema_name=schema, catalog_name=ENV.s3tables_catalog) as conn,
7171
conn.cursor() as cursor,
7272
):
73-
cursor.execute(
74-
f"CREATE TABLE {schema}.{table} (a INT, b STRING) "
75-
"PARTITIONED BY (b) TBLPROPERTIES ('table_type'='ICEBERG')"
76-
)
7773
try:
74+
# Inside try: a CREATE that fails after Athena made the table
75+
# still gets it dropped.
76+
cursor.execute(
77+
f"CREATE TABLE {schema}.{table} (a INT, b STRING) "
78+
"PARTITIONED BY (b) TBLPROPERTIES ('table_type'='ICEBERG')"
79+
)
7880
glue = conn._glue
7981
# Glue addresses a table-bucket catalog by its Athena name.
8082
assert self._view(
8183
glue.get_table(ENV.s3tables_catalog, schema, table)
8284
) == self._view(cursor.get_table_metadata(table))
83-
assert [
84-
self._view(m) for m in glue.list_tables(ENV.s3tables_catalog, schema, table)
85-
] == [self._view(m) for m in cursor.list_table_metadata(expression=table)]
85+
listed = glue.list_tables(ENV.s3tables_catalog, schema, table)
86+
assert [m.name for m in listed] == [table]
87+
assert [self._view(m) for m in listed] == [
88+
self._view(m) for m in cursor.list_table_metadata(expression=table)
89+
]
8690
assert schema in [d.name for d in glue.list_databases(ENV.s3tables_catalog)]
8791
finally:
8892
cursor.execute(f"DROP TABLE IF EXISTS {schema}.{table}")

0 commit comments

Comments
 (0)