You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run dbt source freshness without using the loaded_at_field keyword (see https://docs.getdbt.com/reference/resource-properties/freshness), then according to the documentation dbt should calculate freshness via warehouse metadata tables for supported adapters.
Although I checked the metadata-tables , the freshness checks failed.
Using the debug flag of dbt I saw the following relevant lines
...
dremio adapter: On source.<path>.<to>.<mytable>: select committed_at as last_modified,
(SELECT CURRENT_TIMESTAMP()) as snapshotted_at
from TABLE( table_snapshot(<path>.<to>.<mytable>) )
...
The main point is, that the select committed_at does not use the max value but all of the commited_at values. Therefore the freshness checks fail.
Suggested Solution:
Having a look at this page dbt-labs/dbt-core#8307 I was able to find out what macro is responsible for that behaviour: dremio__get_relation_last_modified.
### Summary
Metadata freshness checks were not working properly if `dbt source
freshness` was ran without using the `loaded_at_field` keyword. This is
because we were not reducing the amount of results to the max
commited_at value in our metadata select statement.
### Description
Added the max operator as suggested by @KingLommel. Also fixed the
relevant test to include more than one snapshot.
### Changelog
- [x] Added a summary of what this PR accomplishes to CHANGELOG.md
### Related Issue
#229
Is there an existing issue for this?
Current Behavior
When I run
dbt source freshness
without using theloaded_at_field
keyword (see https://docs.getdbt.com/reference/resource-properties/freshness), then according to the documentation dbt should calculate freshness via warehouse metadata tables for supported adapters.Although I checked the metadata-tables , the freshness checks failed.
Using the debug flag of dbt I saw the following relevant lines
The main point is, that the
select committed_at
does not use themax
value but all of thecommited_at
values. Therefore the freshness checks fail.Suggested Solution:
Having a look at this page dbt-labs/dbt-core#8307 I was able to find out what macro is responsible for that behaviour:
dremio__get_relation_last_modified
.At this point https://github.com/dremio/dbt-dremio/blob/main/dbt/include/dremio/macros/adapters/metadata.sql we can see the macro
Changing the select statement to use
max
solved all my problems:Expected Behavior
No response
Steps To Reproduce
No response
Environment
Relevant log output
No response
The text was updated successfully, but these errors were encountered: