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
Copy file name to clipboardExpand all lines: website/docs/reference/resource-properties/freshness.md
+33-1Lines changed: 33 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,38 @@ A freshness block is used to define the acceptable amount of time between the mo
37
37
38
38
In the `freshness` block, one or both of `warn_after` and `error_after` can be provided. If neither is provided, then dbt will not calculate freshness snapshots for the tables in this source.
39
39
40
+
<VersionBlockfirstVersion="1.7">
41
+
42
+
In most cases, the `loaded_at_field` is required. Some adapters support calculating source freshness from the warehouse metadata tables and can exclude the `loaded_at_field`.
43
+
44
+
If a source has a `freshness:` block, dbt will attempt to calculate freshness for that source:
45
+
- If a `loaded_at_field` is provided, dbt will calculate freshness via a select query (behavior prior to v1.7).
46
+
- If a `loaded_at_field` is _not_ provided, dbt will calculate freshness via warehouse metadata tables when possible (new in v1.7 on supported adapters).
47
+
48
+
Currently, calculating freshness from warehouse metadata tables is supported on:
- a `freshness` and `loaded_at_field` property added to a source will be applied to all all tables defined in that source
58
+
- a `freshness` and `loaded_at_field` property added to a source _table_ will override any properties applied to the source.
59
+
60
+
This is useful when all of the tables in a source have the same `loaded_at_field`, as is often the case.
61
+
62
+
To exclude a source from freshness calculations, you have two options:
63
+
- Don't add a `freshness:` block.
64
+
- Explicitly set `freshness: null`.
65
+
66
+
## loaded_at_field
67
+
(Optional on adapters that support pulling freshness from warehouse metadata tables, required otherwise.)
68
+
</VersionBlock>
69
+
70
+
<VersionBlocklastVersion="1.6">
71
+
40
72
Additionally, the `loaded_at_field` is required to calculate freshness for a table. If a `loaded_at_field` is not provided, then dbt will not calculate freshness for the table.
41
73
42
74
Freshness blocks are applied hierarchically:
@@ -47,7 +79,7 @@ This is useful when all of the tables in a source have the same `loaded_at_field
47
79
48
80
## loaded_at_field
49
81
(Required)
50
-
82
+
</VersionBlock>
51
83
A column name (or expression) that returns a timestamp indicating freshness.
52
84
53
85
If using a date field, you may have to cast it to a timestamp:
0 commit comments