Make BigQuery cache lookups case-insensitive
See original GitHub issueUPDATE: added step 4 to reproduction recipe
Describe the bug
The is_incremental() macro always returns false when the target is BigQuery, effectively disabling the incremental build feature.
Steps To Reproduce
- Create a fresh DBT project with dbt init
- Configure the profile to use BigQuery
- Change the “my_first_dbt_model.sql” file to this:
{{ config(materialized=‘incremental’) }} select 1 as id {% if is_incremental() %} THIS SHOULD CAUSE AN ERROR {% endif %}
- execute “dbt run” to initially create the table
- execute “dbt run” again => no error is displayed (bug)
- execute “dbt run --bypass-cache” => error is displayed (expected behaviour)
Expected behavior
An error message should be displayed when calling “dbt run” because the SQL inside the is_incremental condition is invalid. When running “dbt run --bypass-cache” the result is as expected.
Additional information
I did a little debugging and verified that is_incremental is indeed returning false. The cause is that adapter.get_relation apparently returns None. Since the problem vanishes when --bypass-cache is specified, I suspect that the problem is caused by a bug in the relation cache.
System information
Which database are you using dbt with?
- postgres
- redshift
- [X ] bigquery
- snowflake
- other (specify: ____________)
The output of dbt --version
:
installed version: 0.14.2
latest version: 0.14.2
Up to date!
The operating system you’re using: macOS Mojave
The output of python --version
:
Python 3.7.4
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
I just tried again with a lower-case dataset name. Then I also get the expected error message on the second call. So it seems that this might indeed be caused by upper characters in the original dataset name.
Thanks @haukeduden - that’s super helpful. I appreciate you taking the time to report this one – we’ll take a look at fixing it!