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

[Core] new loaded_at_query config for source freshness - dbt-core Issue #8797 #6695

Open
FishtownBuildBot opened this issue Dec 19, 2024 · 0 comments
Labels
content Improvements or additions to content dbt Core The changes proposed in this issue relate to dbt Core dbt-core v1.10 improvement Use this when an area of the docs needs improvement as it's currently unclear

Comments

@FishtownBuildBot
Copy link

FishtownBuildBot commented Dec 19, 2024

Originating from this issue: dbt-labs/dbt-core#8797

new loaded_at_query config for source freshness - the ability to specify custom sql to generate the maxLoadedAt time stamp on the source (vs. the "built-in" one which uses the loaded_at_field - collect_freshness)

example (check this works):

sources:
  - name: my_source
    freshness:
      error_after:
        count: 2
        period: hour 
    loaded_at_query: |
      select from audit_tables
      where table_name = {{ this.identifier }}
      and status = 'completed'

Notes:

  • cannot specify both loaded_at_field and loaded_at_query:
sources:
  - name: jaffle_shop
    database: raw
    freshness: 
      error_after: {count: 24, period: hour}
    loaded_at_field: _etl_loaded_at
    loaded_at_query: ...
  • if you specify something like this, whatever is "closest" to the table wins:
sources:
  - name: jaffle_shop
    database: raw
    freshness: 
      error_after: {count: 24, period: hour}
    loaded_at_field: _etl_loaded_at
    tables:
      - name: orders
        loaded_at_query: ...
  • filter won't work for loaded_at_query
@runleonarun runleonarun added content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear dbt Core The changes proposed in this issue relate to dbt Core labels Dec 19, 2024
@graciegoheen graciegoheen changed the title [Core] Docs Changes Needed from dbt-core Issue #8797 [Core] new loaded_at_query config for source freshness - dbt-core Issue #8797 Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Improvements or additions to content dbt Core The changes proposed in this issue relate to dbt Core dbt-core v1.10 improvement Use this when an area of the docs needs improvement as it's currently unclear
Projects
None yet
Development

No branches or pull requests

3 participants