Skip to content

Commit

Permalink
Make sure partition_by is in config if setting require_partition_filt…
Browse files Browse the repository at this point in the history
…er (dbt-labs#109)

* initial commit

* update changelog

* fix typo in changelog

* Hui's feedback
  • Loading branch information
oliverrmaa authored Jan 28, 2022
1 parent 7385ea6 commit 42368f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@

### Fixes
- Fix test related to preventing coercion of boolean values (True, False) to numeric values (0, 1) in query results ([#93](https://github.com/dbt-labs/dbt-bigquery/issues/93))
- Add a check in `get_table_options` to check that the table has a `partition_by` in the config.
This will prevent BigQuery from throwing an error since non-partitioned tables cannot have `require_partition_filter` ([#107](https://github.com/dbt-labs/dbt-bigquery/issues/107))

### Under the hood
- Address BigQuery API deprecation warning and simplify usage of `TableReference` and `DatasetReference` objects ([#97](https://github.com/dbt-labs/dbt-bigquery/issues/97))

### Contributors
- [@hui-zheng](https://github.com/hui-zheng)([#50](https://github.com/dbt-labs/dbt-bigquery/pull/50))
- [@oliverrmaa](https://github.com/oliverrmaa)([#109](https://github.com/dbt-labs/dbt-bigquery/pull/109))

## dbt-bigquery 1.0.0 (December 3, 2021)

Expand Down
3 changes: 2 additions & 1 deletion dbt/adapters/bigquery/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,8 @@ def get_table_options(
# It doesn't apply the `require_partition_filter` option for a temporary table
# so that we avoid the error by not specifying a partition with a temporary table
# in the incremental model.
if config.get('require_partition_filter') is not None:
if config.get('require_partition_filter') is not None and \
config.get('partition_by') is not None:
opts['require_partition_filter'] = config.get(
'require_partition_filter')
if config.get('partition_expiration_days') is not None:
Expand Down

0 comments on commit 42368f9

Please sign in to comment.