From 9cad3ec7ae173834c1d5d8d024e4ce04544e3437 Mon Sep 17 00:00:00 2001 From: Marcin Rudolf Date: Tue, 10 Dec 2024 23:24:01 +0100 Subject: [PATCH] fixes gcp oauth iceberg credentials handling --- dlt/common/configuration/specs/gcp_credentials.py | 6 ++++++ tests/load/utils.py | 9 +-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/dlt/common/configuration/specs/gcp_credentials.py b/dlt/common/configuration/specs/gcp_credentials.py index 21ae2587ed..17519b032a 100644 --- a/dlt/common/configuration/specs/gcp_credentials.py +++ b/dlt/common/configuration/specs/gcp_credentials.py @@ -356,3 +356,9 @@ def parse_native_representation(self, native_value: Any) -> None: except NativeValueError: pass GcpOAuthCredentialsWithoutDefaults.parse_native_representation(self, native_value) + + def to_pyiceberg_fileio_config(self) -> Dict[str, Any]: + if self.has_default_credentials(): + return GcpDefaultCredentials.to_pyiceberg_fileio_config(self) + else: + return GcpOAuthCredentialsWithoutDefaults.to_pyiceberg_fileio_config(self) diff --git a/tests/load/utils.py b/tests/load/utils.py index 7835927f5c..5660202ec3 100644 --- a/tests/load/utils.py +++ b/tests/load/utils.py @@ -636,14 +636,7 @@ def destinations_configs( table_format="iceberg", supports_merge=False, file_format="parquet", - credentials=( - resolve_configuration( - GcpOAuthCredentialsWithoutDefaults(), - sections=("destination", "fsgcpoauth"), - ) - if bucket == GCS_BUCKET - else None - ), + destination_name="fsgcpoauth" if bucket == GCS_BUCKET else None, ) ]