-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Allow partition filters to be passed to source freshness checks #1495
Comments
Thanks for making this issue @whittid4! I think that mandatory partition requirements are a good idea for source tables on BQ, so I'd be interested in figuring out a way to make this work. The challenge here dbt tries to discern:
Adding a filter here won't necessarily impact dbt's ability to to determine if fresh records exist, but it probably could impact dbt's knowledge of when the table was last loaded into. I can imagine a version: 2
sources:
- name: ecommerce
loaded_at_field: date
freshness:
warn_after: {count: 12, period: hour}
error_after: {count: 24, period: hour}
filter: "date > date_sub(current_date(), INTERVAL 7 days) # this is new
tables:
- name: orders You buy that? |
Hey, adding to this I'd make At the moment the workaround would be as suggested by you, @drewbanin to create views for the sources, but that creates somewhat of a semantic duplication that requires context. Would be great if it could all be kept neatly in one place. |
Thanks for that @thenaturalist - really good point! |
Hey @drewbanin another issue I noticed today: The current limitation of taking the route through ephemeral models forces a duplication of all sources in a given |
Hey @thenaturalist - check out #1776 - that in-progress PR implements filtering for Regarding schema tests: We're going to hold off on automatically implementing filters for schema tests on BQ at the moment. This is very possible to implement in user-space, and it may be something that we choose to prioritize in dbt natively in the future. You can find all of dbt's built-in schema tests here. You can make your own copies of these test macros specifying filters as required. Here's an example of what that might look like:
You can make this |
…lters-sources Add filter field to source table definitions (#1495)
Feature
Allow partition filters to be passed to source freshness checks
If the source table has a mandatory partition filter (as BigQuery offers) then the out-of-the-box freshness check will fail since the partition filter cannot be passed to the SQL query.
Cannot query over table 'prod.core.stock' without a filter over column(s) 'date' that can be used for partition elimination
This is because the query generated from the freshness check runs the following:
Who will this benefit?
This feature would benefit users who have mandatory partitions applied to tables. It is currently an issue with BigQuery, but would apply to any source that has the mandatory partition feature.
The text was updated successfully, but these errors were encountered: