Skip to content

Commit

Permalink
add AWS_REGION to storage_options (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
chidifrank authored Sep 6, 2024
1 parent f88ade5 commit b0cb467
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dbt/adapters/duckdb/plugins/unity.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ class Plugin(BasePlugin):
# The Unitycatalog client
uc_client: Unitycatalog

# The AWS region
aws_region: str

def initialize(self, config: Dict[str, Any]):
# Assert that the credentials and secrets are present
assert self.creds is not None, "Credentials are required for the plugin!"
Expand All @@ -228,6 +231,9 @@ def initialize(self, config: Dict[str, Any]):
# Find the UC secret
uc_secret = find_secrets_by_type(self.creds.secrets, "UC")

# Get AWS region from the UC secret
self.aws_region = uc_secret["aws_region"]

# Get the endpoint from the UC secret
host_and_port = uc_secret["endpoint"]

Expand Down Expand Up @@ -287,6 +293,9 @@ def store(self, target_config: TargetConfig, df: pa.lib.Table = None):
storage_format=storage_format,
)

# extend the storage options with the aws region
storage_options["AWS_REGION"] = self.aws_region

# extend the storage options with the temporary table credentials
storage_options = storage_options | uc_get_storage_credentials(
self.uc_client, self.catalog_name, schema_name, table_name
Expand Down

0 comments on commit b0cb467

Please sign in to comment.