Skip to content

Commit

Permalink
split up relation into parts to build up to_relation
Browse files Browse the repository at this point in the history
  • Loading branch information
McKnight-42 committed Apr 18, 2024
1 parent 28e1f47 commit 5ed2d74
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{% macro postgres__get_rename_materialized_view_sql(relation, new_name) %}
{% if relation is not none %}
{% set database = relation.database %}
{% set schema = relation.schema %}
{% set to_relation = adapter.get_relation(database=database, schema=schema, identifier=new_name) %}
{% if to_relation is not none %}
{{ adapter.rename_relation(from_relation=relation, to_relation=to_relation) }}
{% endif %}
{% endif %}
alter materialized view {{ relation }} rename to {{ new_name }}
{% endmacro %}

0 comments on commit 5ed2d74

Please sign in to comment.