Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Custom Iceberg base_location #1289

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

LProcopi15
Copy link

@LProcopi15 LProcopi15 commented Jan 13, 2025

resolves #1284
Related docs

Problem

Currently, we only allow users to append a base_location_subpath to a base_location when creating a Snowflake Iceberg table. We've hard coded in the base_location root to be _dbt/<schema-name>/<table-name>.

Some customers have requested we allow overrides of the top-level _dbt/ directory. After discussing with product (@amychen1776), we've decided to add support for this.


Solution

Add a new optional config for Snowflake called base_location_root. If this is provided, it will override the default dbt base_location value (_dbt/<schema_name>/<table_name>/) to base_location_root/<schema_name>/<table_name>/)

Examples from test runs:

Configs for _MODEL_BASIC_ICEBERG_MODEL: base_location_subpath="subpath", (no base_location_root). Snowflake ddl generated:

create or replace iceberg table analytics.test17370768401216806666_test_table_basic.iceberg_table
 ...
        base_location = '_dbt/test17370768401216806666_test_table_basic/iceberg_table/subpath'
...

Configs for _MODEL_BASIC_ICEBERG_MODEL_WITH_PATH: base_location_root="root_path", (no base_location_subpath). Snowflake ddl generated:

create or replace iceberg table analytics.test17370768401216806666_test_table_basic.iceberg_tableb
...
      base_location = 'root_path/test17370768401216806666_test_table_basic/iceberg_tableb'
....

Configs for _MODEL_BASIC_ICEBERG_MODEL_WITH_PATH_SUBPATH: base_location_root="root_path", base_location_subpath="subpath",. Snowflake ddl generated:

create or replace iceberg table analytics.test17370768401216806666_test_table_basic.iceberg_tablec
...
     base_location = 'root_path/test17370768401216806666_test_table_basic/iceberg_tablec/subpath'
...

Validation of Unit Tests

image

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has already received feedback and approval from Product or DX
    @amychen1776 and I have discussed and aligned on these changes.

Copy link

cla-bot bot commented Jan 13, 2025

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @LProcopi15

Copy link
Contributor

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the dbt-snowflake contributing guide.

@cla-bot cla-bot bot added the cla:yes label Jan 13, 2025
@LProcopi15 LProcopi15 changed the title update relation & add tests Feature: Custom Iceberg base_location Jan 13, 2025
@LProcopi15 LProcopi15 marked this pull request as ready for review January 15, 2025 21:11
@LProcopi15 LProcopi15 requested a review from a team as a code owner January 15, 2025 21:11
cluster_by=['id'],
table_format="iceberg",
external_volume="s3_iceberg_snow",
base_location="base_path",
Copy link

@amychen1776 amychen1776 Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for this test, do we not need an actual base_path? (I honestly have no idea but wanted to ask)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the path doesn't already exist, it is created by Snowflake when you run create or replace iceberg table, so for our test we don't need to use an existing path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Iceberg Custom base_location
2 participants