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

Liquid clustered table creation is failing when running together with model in insert_overwrite incremental strategy under one run session #931

Open
kevinkevin1 opened this issue Feb 5, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@kevinkevin1
Copy link

kevinkevin1 commented Feb 5, 2025

Describe the bug

  1. Databricks has dynamic partition overwrite config (here) which allow us to implement insert_overwrite incremental strategy.

  2. DBT set spark.sql.sources.partitionOverwriteMode to DYNAMIC during the incremental step of table with insert_overwrite strategy (dbt-databricks source code).

  3. This can create conflict for liquid clustered table down the line within the same DBT running session. Liquid clustered table couldn’t be created if dynamic partition overwrite mode is enabled. It will trigger the following error DELTA_CLUSTERING_WITH_DYNAMIC_PARTITION_OVERWRITE.

Steps To Reproduce

  1. Create a liquid clustered model with upstream table updated with insert_overwrite strategy & incremental materialization.
  2. Run dbt command with single thread to force it in one single session.
dbt run -s +liquid_clustered_model --threads 1

Expected behavior

DBT should always run set spark.sql.sources.partitionOverwriteMode = STATIC as a pre-hook for liquid clustered model to ensure it will always avoid this kind of failure.

This can be fixed easily by set the same syntax above as liquid cluster model's pre-hook. However, DBT should be able to handle this automatically under the hood.

Screenshots and log output

none

System information

The output of dbt --version:

Core:
  - installed: 1.8.4
  - latest:    1.9.2 - Update available!

  Your version of dbt-core is out of date!
  You can find instructions for upgrading here:
  https://docs.getdbt.com/docs/installation

Plugins:
  - databricks: 1.8.3 - Update available!
  - spark:      1.8.0 - Update available!

  At least one plugin is out of date or incompatible with dbt-core.
  You can find instructions for upgrading here:
  https://docs.getdbt.com/docs/installation

Operating system: MacOS Sonoma 14.6.1

Python version: Python 3.11.11

Additional context

none

@kevinkevin1 kevinkevin1 added the bug Something isn't working label Feb 5, 2025
@kevinkevin1 kevinkevin1 changed the title Incremental is failing when insert_overwrite run together with liquid clustered table Incremental is failing when insert_overwrite and liquid clustered table run in a single session Feb 5, 2025
@kevinkevin1 kevinkevin1 changed the title Incremental is failing when insert_overwrite and liquid clustered table run in a single session Liquid clustered table creation is failing when running together with model in insert_overwrite incremental strategy under one run session Feb 5, 2025
@benc-db
Copy link
Collaborator

benc-db commented Feb 6, 2025

Does this behavior still exist in 1.9.x?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants