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

[Bug] on_configuration_changes=apply does not add new index on incremental view #155

Closed
2 tasks done
LoicEm opened this issue Oct 10, 2024 · 1 comment
Closed
2 tasks done
Labels
bug Something isn't working triage

Comments

@LoicEm
Copy link

LoicEm commented Oct 10, 2024

Is this a new bug?

  • I believe this is a new bug
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

When I add a new index to an existing incremental model (see below), it is not created in the database

Expected Behavior

I would expect the new index to be created

Steps To Reproduce

  1. This is the output of pip freeze | grep dbt
dbt-adapters==1.7.0
dbt-common==1.10.0
dbt-core==1.8.7
dbt-extractor==0.5.1
dbt-postgres==1.8.2
dbt-semantic-interfaces==0.5.1
  1. Below is the original file test.sql I run
{{ config(
    materialized="incremental",
    on_configuration_changes="apply",
    indexes=[
        {'columns': ['a']}
             ]
    )
}}

select * from (VALUES(1, 'a'), (2, 'b'), (3, 'c')) as t(a, b)

dbt run --select test

  1. Modify test.sql to add an index
{{ config(
    materialized="incremental",
    on_configuration_changes="apply",
    indexes=[
        {'columns': ['a']},
        {'columns': ['a', 'b']}
             ]
    )
}}

select * from (VALUES(1, 'a'), (2, 'b'), (3, 'c')) as t(a, b)
  1. rerun dbt run --select test
  2. A new index should be created (or the run should fail if on_configuration_changes="fail") but nothing happens.
  3. Same behavior if I am removing the existing index, it is kept in place

Relevant log output

No response

Environment

- OS: Ubuntu 20.04
- Python:3.8.5
- dbt-postgres: 1.8.2

Additional Context

The related documentation on postgre website

@LoicEm LoicEm added bug Something isn't working triage labels Oct 10, 2024
@LoicEm
Copy link
Author

LoicEm commented Oct 10, 2024

My bad, it is clearly stated in the on_configuration_changes documentation that this currently only supported for materialized_view materialization.

I'm new to DBT, so I did not understand that this was a specific type of materialization at first, closing the issue

@LoicEm LoicEm closed this as completed Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

1 participant