Skip to content

Commit

Permalink
fix: add 'CatalogId' Parameter to Glue Paginator Call (Related to PR #…
Browse files Browse the repository at this point in the history
…370) (#467)

Co-authored-by: nicor88 <[email protected]>
  • Loading branch information
brunofaustino and nicor88 authored Oct 19, 2023
1 parent 502939b commit 116fd73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dbt/adapters/athena/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,14 @@ def clean_up_partitions(self, relation: AthenaRelation, where_condition: str) ->
conn = self.connections.get_thread_connection()
client = conn.handle

data_catalog = self._get_data_catalog(relation.database)
catalog_id = get_catalog_id(data_catalog)

with boto3_client_lock:
glue_client = client.session.client("glue", region_name=client.region_name, config=get_boto3_config())
paginator = glue_client.get_paginator("get_partitions")
partition_params = {
"CatalogId": catalog_id,
"DatabaseName": relation.schema,
"TableName": relation.identifier,
"Expression": where_condition,
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ def test_get_table_location_with_failure(self, dbt_debug_caplog, mock_aws_servic
@mock_glue
@mock_s3
@mock_athena
@mock_sts
def test_clean_up_partitions_will_work(self, dbt_debug_caplog, mock_aws_service):
table_name = "table"
mock_aws_service.create_data_catalog()
Expand Down

0 comments on commit 116fd73

Please sign in to comment.