Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 43b0bc2

Browse files
author
Hironori Yamamoto
authored
feat: remove partition schema when incremental model overwrites partitions (#620)
1 parent efb0ce0 commit 43b0bc2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

dbt/adapters/athena/impl.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,12 @@ def clean_up_partitions(self, relation: AthenaRelation, where_condition: str) ->
407407
partitions = partition_pg.build_full_result().get("Partitions")
408408
for partition in partitions:
409409
self.delete_from_s3(partition["StorageDescriptor"]["Location"])
410+
glue_client.delete_partition(
411+
CatalogId=catalog_id,
412+
DatabaseName=relation.schema,
413+
TableName=relation.identifier,
414+
PartitionValues=partition["Values"],
415+
)
410416

411417
@available
412418
def clean_up_table(self, relation: AthenaRelation) -> None:
@@ -743,7 +749,7 @@ def list_relations_without_caching(self, schema_relation: AthenaRelation) -> Lis
743749
LOGGER.debug(f"Table '{table['Name']}' has no TableType attribute - Ignoring")
744750
continue
745751
_type = table["TableType"]
746-
_detailed_table_type = table["Parameters"].get("table_type", "")
752+
_detailed_table_type = table.get("Parameters", {}).get("table_type", "")
747753
if _type == "VIRTUAL_VIEW":
748754
_type = self.Relation.View
749755
else:

0 commit comments

Comments
 (0)