From 116fd7312d0a434d067df99d287044c9acf06100 Mon Sep 17 00:00:00 2001 From: brunofaustino Date: Thu, 19 Oct 2023 13:02:22 -0300 Subject: [PATCH] fix: add 'CatalogId' Parameter to Glue Paginator Call (Related to PR #370) (#467) Co-authored-by: nicor88 <6278547+nicor88@users.noreply.github.com> --- dbt/adapters/athena/impl.py | 4 ++++ tests/unit/test_adapter.py | 1 + 2 files changed, 5 insertions(+) diff --git a/dbt/adapters/athena/impl.py b/dbt/adapters/athena/impl.py index 2da2e83b..d2cc0061 100755 --- a/dbt/adapters/athena/impl.py +++ b/dbt/adapters/athena/impl.py @@ -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, diff --git a/tests/unit/test_adapter.py b/tests/unit/test_adapter.py index 81330011..733d7f8d 100644 --- a/tests/unit/test_adapter.py +++ b/tests/unit/test_adapter.py @@ -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()