Skip to content

Commit

Permalink
Macros: Override list_relations_without_caching
Browse files Browse the repository at this point in the history
CrateDB does not support MATERIALIZED VIEW.
  • Loading branch information
amotl committed Nov 25, 2024
1 parent 85daf99 commit 3417f86
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions dbt/include/cratedb/macros/relations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,35 @@
{{ return(load_result('relations').table) }}
{% endmacro %}

{# TODO: Needs a software test #}
{% macro cratedb__list_relations_without_caching(schema_relation) %}
{% call statement('list_relations_without_caching', fetch_result=True) -%}
select
'{{ schema_relation.database }}' as database,
tablename as name,
schemaname as schema,
'table' as type
from pg_tables
where schemaname ilike '{{ schema_relation.schema }}'
union all
select
'{{ schema_relation.database }}' as database,
viewname as name,
schemaname as schema,
'view' as type
from pg_views
where schemaname ilike '{{ schema_relation.schema }}'
{# CrateDB: MATERIALIZED VIEW not supported #}
{#
union all
select
'{{ schema_relation.database }}' as database,
matviewname as name,
schemaname as schema,
'materialized_view' as type
from pg_matviews
#}
where schemaname ilike '{{ schema_relation.schema }}'
{% endcall %}
{{ return(load_result('list_relations_without_caching').table) }}
{% endmacro %}

0 comments on commit 3417f86

Please sign in to comment.