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

Fix materialized_views filters when listing relations #353

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions .changes/unreleased/Fixes-20230927-124454.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: Fixes
body: Fix materialized_views filters when listing relations
time: 2023-09-27T12:44:54.858517+02:00
custom:
Author: findepi
Issue: ""
PR: "353"
7 changes: 4 additions & 3 deletions dbt/include/trino/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@
else t.table_type
end as table_type
from {{ relation.information_schema() }}.tables t
left join system.metadata.materialized_views mv
left join (
select * from system.metadata.materialized_views
where catalog_name = '{{ relation.database | lower }}'
and schema_name = '{{ relation.schema | lower }}') mv
on mv.catalog_name = t.table_catalog and mv.schema_name = t.table_schema and mv.name = t.table_name
where t.table_schema = '{{ relation.schema | lower }}'
and (mv.catalog_name is null or mv.catalog_name = '{{ relation.database | lower }}')
and (mv.schema_name is null or mv.schema_name = '{{ relation.schema | lower }}')
{% endcall %}
{{ return(load_result('list_relations_without_caching').table) }}
{% endmacro %}
Expand Down
Loading