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_root #1289

Merged
merged 13 commits into from
Jan 24, 2025

Conversation

LProcopi15
Copy link
Contributor

@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 Tests

See passing functional & unit tests in CI


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
@LProcopi15 LProcopi15 changed the title Feature: Custom Iceberg base_location Feature: Custom Iceberg base_location_root Jan 17, 2025
Copy link
Contributor

@mikealfare mikealfare left a comment

Choose a reason for hiding this comment

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

Looks good. There are two issues that look like copy paste errors and then a nice to have if you feel like it and think it would be better than what you have.

tests/functional/iceberg/models.py Outdated Show resolved Hide resolved
tests/functional/iceberg/models.py Outdated Show resolved Hide resolved
tests/unit/test_iceberg_location.py Show resolved Hide resolved
@colin-rogers-dbt colin-rogers-dbt enabled auto-merge (squash) January 24, 2025 18:31
@colin-rogers-dbt colin-rogers-dbt merged commit 5d935ee into main Jan 24, 2025
18 checks passed
@colin-rogers-dbt colin-rogers-dbt deleted the lprocopi_custom_base_location branch January 24, 2025 19:29
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
4 participants