Skip to content

Commit

Permalink
feat: remove partition schema when incremental model overwrites parti…
Browse files Browse the repository at this point in the history
…tions (dbt-labs#620)
  • Loading branch information
Hironori Yamamoto authored Apr 9, 2024
1 parent efb0ce0 commit 43b0bc2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dbt/adapters/athena/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@ def clean_up_partitions(self, relation: AthenaRelation, where_condition: str) ->
partitions = partition_pg.build_full_result().get("Partitions")
for partition in partitions:
self.delete_from_s3(partition["StorageDescriptor"]["Location"])
glue_client.delete_partition(
CatalogId=catalog_id,
DatabaseName=relation.schema,
TableName=relation.identifier,
PartitionValues=partition["Values"],
)

@available
def clean_up_table(self, relation: AthenaRelation) -> None:
Expand Down Expand Up @@ -743,7 +749,7 @@ def list_relations_without_caching(self, schema_relation: AthenaRelation) -> Lis
LOGGER.debug(f"Table '{table['Name']}' has no TableType attribute - Ignoring")
continue
_type = table["TableType"]
_detailed_table_type = table["Parameters"].get("table_type", "")
_detailed_table_type = table.get("Parameters", {}).get("table_type", "")
if _type == "VIRTUAL_VIEW":
_type = self.Relation.View
else:
Expand Down

0 comments on commit 43b0bc2

Please sign in to comment.