-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Draft implementation of metadata-based freshness
- Loading branch information
1 parent
658e16e
commit e39a6e7
Showing
3 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Features | ||
body: Add support for checking table-last-modified by metadata | ||
time: 2023-10-08T19:54:10.503476-04:00 | ||
custom: | ||
Author: peterallenwebb | ||
Issue: "785" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{% macro snowflake__get_relation_last_modified(information_schema, relations) -%} | ||
|
||
{%- call statement('last_modified', fetch_result=True) -%} | ||
select table_schema as schema, | ||
table_name as identifier, | ||
last_altered as last_modified, | ||
{{ current_timestamp() }} as snapshotted_at | ||
from {{ information_schema }}.tables | ||
where ( | ||
{%- for relation in relations -%} | ||
(upper(table_schema) = upper('{{ relation.schema }}') and | ||
upper(table_name) = upper('{{ relation.identifier }}')){%- if not loop.last %} or {% endif -%} | ||
{%- endfor -%} | ||
) | ||
{%- endcall -%} | ||
|
||
{{ return(load_result('last_modified')) }} | ||
|
||
{% endmacro %} |