-
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 require_partition_filter=true for BigQuery table creation #1843
Comments
cool idea @hui-zheng! See also #1829 -- both of these issues require dbt to set I think we could support this pretty readily:
And that's it! What do you think about that? |
yes, I agree with this approach. |
I've just done a minimal-effort implementation by overwriting the essential macros in my own macros folder and just want to add what I found out on the way: You will also need to touch the
This is (purposefully) hacky but works for me, I'm not recommending going this route, just wanted to make you aware of the limitation. Note that you will also need to supply the argument as a literal, something like The compiled and ready to run sql then looks something like this:
Edit 2019-11-04: I wanted to add that if the merge joins
So the one thing that doesn't work is having both a |
@soltanianalytics thanks so much for the heads up! The logic you implemented reminds me a lot of #1034. I think this is a problem we'll generally need to solve on BQ sometime soon - it's great to know that these two pieces of functionality are related. |
Hey @drewbanin just wanted to check if this something that will be supported sometime soon? Would be a super useful config variable to have available. |
Agree that this would be a great first issue for an external contributor! One small thing to note about tables that require partition filters, very much outside the scope of the actual code change required here: Built-in schema tests will not work on these models. You'll need to instead use tests like models:
- name: my_model
columns:
- name: id
tests:
- dbt_utils.unique_where:
where: "{{ config.get('partition_by') ~ '= current_date' if config.get('partition_by_required') else '1=1' }}" |
If no one hasn't worked on it yet, I will send a PR. |
Describe the feature
I would like to have enable require_partition_filter=true in table and incremental mode.
https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#table_option_list
for example, we could config model as
Currently, in 0.14.3, bigquery/adapters.sql, only persist_docs and temporary options is enable.
Could we make bigquery_table_options macro below flexible to take in any other options, so that we could pass a generic key/value list in model config to create table options
{% macro bigquery_table_options(persist_docs, temporary) %}
for example, we could config model as
Additional context
This feature is BigQuery-specific.
Who will this benefit?
This feature will benefit anyone who use BigQuery partition tables, and users of BigQuery in general.
The text was updated successfully, but these errors were encountered: