Skip to content

Commit 5813e74

Browse files
authored
CTAS table delete (#797)
* Deleting in correct database * Upgrading dependencies
1 parent c77848a commit 5813e74

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

awswrangler/athena/_read.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,9 @@ def _resolve_query_without_cache(
558558
boto3_session=boto3_session,
559559
)
560560
finally:
561-
catalog.delete_table_if_exists(database=database, table=name, boto3_session=boto3_session)
561+
catalog.delete_table_if_exists(
562+
database=ctas_database_name or database, table=name, boto3_session=boto3_session
563+
)
562564
return _resolve_query_without_cache_regular(
563565
sql=sql,
564566
database=database,

tests/test_athena.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def test_athena_ctas(path, path2, path3, glue_table, glue_table2, glue_database,
112112
ctas_temp_table_name=glue_table2,
113113
s3_output=path3,
114114
)
115-
assert wr.catalog.does_table_exist(database=glue_ctas_database, table=glue_table2) is True
115+
assert wr.catalog.does_table_exist(database=glue_ctas_database, table=glue_table2) is False
116116
assert len(wr.s3.list_objects(path=path3)) > 2
117117
assert len(wr.s3.list_objects(path=final_destination)) > 0
118118
for df in dfs:

0 commit comments

Comments
 (0)