dbt-labs / dbt-labs/dbt

[Snowflake] iceberg_rest: no way to set BASE_LOCATION on vended-credential CLDs (required by Snowflake)

Open
#16,154 0 comments 0 reactions 0 assignees View on GitHub
adapter:snowflake area:catalog-v2 proj:catalog-v2 triage
Dominant language
Rust
Stars
13.8k
Forks
2.6k
Avg merge
21h 31m
Merged PRs (30d)
56

Description

> Sub-issue of #16016. Related: #15924 (`CREATE OR REPLACE` on non-vended CLDs — a different bug in the same macro).

## Summary

For a Snowflake catalog-linked database (CLD) backed by a credential-vending catalog integration, Snowflake **requires** an absolute `BASE_LOCATION` on `CREATE ICEBERG TABLE`. The dbt-snowflake `iceberg_rest` path provides no way to set one, so vended-credential CLDs cannot be materialized as expected.

Snowflake documents `BASE_LOCATION` as a CLD parameter and states: "If you're using vended credentials, you must also specify an absolute path."

https://docs.snowflake.com/en/sql-reference/sql/create-iceberg-table-rest

## Current behavior

Neither the generic CLD macro nor the Glue variant emits `BASE_LOCATION`, and there is no config plumbed through to supply one:

- The generic CLD path suppresses the entire `external_volume` / `catalog` / `base_location` block for CLDs: https://github.com/dbt-labs/fs/blob/a6dc263074854b7f28a9925a7494cedee11cab06/fs/sa/crates/dbt-loader/src/dbt_macro_assets/dbt-snowflake/macros/relations/table/create.sql#L437-L439
- The `snowflake__create_table_iceberg_rest_with_glue` variant emits `external_volume`, `iceberg_version`, `target_file_size`, `auto_refresh`, and `max_data_extension_time_in_days`, but no `BASE_LOCATION`.
- `build_snowflake_linked_with_catalogs_v2` hardcodes `base_location: None` and does not read any base-location field: https://github.com/dbt-labs/fs/blob/a6dc263074854b7f28a9925a7494cedee11cab06/fs/sa/crates/dbt-adapter/src/catalog_relation/catalog_relation_v2.rs#L599-L611
- `reject_unsupported_snowflake_linked_v2_model_fields` actively rejects `base_location_root`, `base_location_subpath`, and `external_volume` with `Snowflake v2 ... does not support model field '...' yet`: https://github.com/dbt-labs/fs/blob/a6dc263074854b7f28a9925a7494cedee11cab06/fs/sa/crates/dbt-adapter/src/catalog_relation/catalog_relation_v2.rs#L383-L398

## Expected behavior

A model or `catalogs.yml` config for an `iceberg_rest` CLD can specify an absolute `BASE_LOCATION`, and the generated DDL includes it, allowing vended-credential CLDs to materialize successfully.

## Scope of change

1. Allow `base_location_root` in the catalogs-v2 linked Snowflake schema, while keeping `base_location_subpath` model-only.
2. Plumb a `base_location` onto the CLD `CatalogRelation` in the v2 linked build.
3. Relax the reject list so base location is accepted for the linked/CLD path.
4. Teach both `snowflake__create_table_iceberg_rest_sql` (CLD branch) and `snowflake__create_table_iceberg_rest_with_glue` to emit `base_location`.

## Upstream parity

dbt-adapters v1 `dbt-snowflake` has the same gap: `IcebergRestCatalogRelation` has no `base_location` field and the REST/Glue macros do not emit one; it is wired only for the built-in managed path. This therefore affects both v1 and Fusion.

## Environment

- dbt Core v1 (`dbt-snowflake`) and Fusion / Core v2
- Snowflake CLD via external AWS Glue catalog with vended credentials

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.