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

Materialized Views not updating cache #9959

Merged
merged 20 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
81b713b
initial push of adding cache functions for materialized views
McKnight-42 Apr 16, 2024
86d07e4
update
McKnight-42 Apr 16, 2024
9f400fd
add cache_renamed
McKnight-42 Apr 16, 2024
6f7c01b
Merge branch '1.7.latest' of github.com:dbt-labs/dbt into mcknight/127
McKnight-42 Apr 16, 2024
342d54b
remove current attempt of add cache_renamed
McKnight-42 Apr 17, 2024
51231a6
add checks for add, and drop to see if relation exists in dispatch macro
McKnight-42 Apr 17, 2024
28e1f47
move calls from distpach macro into the default call/postgres specifi…
McKnight-42 Apr 18, 2024
5ed2d74
split up relation into parts to build up to_relation
McKnight-42 Apr 18, 2024
7e56792
move cache_dropped back to the dispatch original dispatch macro
McKnight-42 Apr 19, 2024
d6f61dc
move cache_dropped back to the dispatch original dispatch macro
McKnight-42 Apr 19, 2024
70049f5
readd removed space between macros
McKnight-42 Apr 19, 2024
64c9cab
move cache_added back to distpach macro
McKnight-42 Apr 19, 2024
39f88fe
remove extra curly brace
McKnight-42 Apr 19, 2024
5f0f049
revert get_relation call back get cache_renamed
McKnight-42 Apr 19, 2024
96bd884
move of cache_renamed to get_rename_sql
McKnight-42 Apr 23, 2024
8352986
remove updated cache_changes and remove Relation.MaterializedView fro…
McKnight-42 Apr 23, 2024
ceff6f2
add changelog
McKnight-42 Apr 23, 2024
4135f65
Merge branch '1.7.latest' into mcknight/127
McKnight-42 Apr 23, 2024
ad2c976
add simple test case, and doc string
McKnight-42 Apr 23, 2024
6fa2619
Merge branch 'mcknight/127' of github.com:dbt-labs/dbt into mcknight/127
McKnight-42 Apr 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% macro get_create_materialized_view_as_sql(relation, sql) -%}
{% if execute %}
{{ adapter.cache_added(relation) }}
{% endif %}
{{- adapter.dispatch('get_create_materialized_view_as_sql', 'dbt')(relation, sql) -}}
{%- endmacro %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ actually executes the drop, and `get_drop_sql`, which returns the template.
*/ #}

{% macro drop_materialized_view(relation) -%}
{{ adapter.cache_dropped(relation) }}
{{ return(adapter.dispatch('drop_materialized_view', 'dbt')(relation)) }}
{%- endmacro %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{% macro get_rename_materialized_view_sql(relation, new_name) %}
{% set database = relation.database %}
{% set schema = relation.schema %}
{% set to_relation = adapter.get_relation(database=database, schema=schema, identifier=new_name) %}
{% if relation is not none %}
{% if to_relation is not none %}
{{ adapter.cache_renamed(from_relation=relation, to_relation=to_relation) }}
{% endif %}
{% endif %}
McKnight-42 marked this conversation as resolved.
Show resolved Hide resolved
{{- adapter.dispatch('get_rename_materialized_view_sql', 'dbt')(relation, new_name) -}}
{% endmacro %}

Expand Down
2 changes: 1 addition & 1 deletion plugins/postgres/dbt/include/postgres/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
on {{ relation }} {% if index_config.type -%}
using {{ index_config.type }}
{%- endif %}
({{ comma_separated_columns }});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removing ;as it doubles up with one at end of statement causing error

({{ comma_separated_columns }})
{%- endmacro %}

{% macro postgres__create_schema(relation) -%}
Expand Down
Loading