calogica / dbt-date

Date-related macros for dbt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'dates' model produces error on BigQuery

milesvant opened this issue · comments

Issue description

Compiled SQL for 'dates' model in dbt-date version 0.2.4 is invalid within BigQuery. dbt run will fail for any BigQuery project which includes this package directly or indirectly (e.g. through dbt-expectations, which is how this bug was discovered in our environment). Since dbt-expectations pulls in the most recent dbt-date 0.2.* version with each invocation of dbt deps, this failing model was introduced into our production deployment without any code changes on our behalf.

Environment description

  • dbt version: 0.18.1
  • dbt-date version: 0.2.4
  • database: BigQuery

Steps to reproduce the issue

  1. dbt deps
  2. dbt run -m dates

What's the expected result?

Model run passes

What's the actual result?

Completed with 1 error and 0 warnings:
Database Error in model dates (models/example_models/dates.sql)
  No matching signature for operator <= for argument types: DATETIME, TIMESTAMP. Supported signature: ANY <= ANY at [160:11]
  compiled SQL at target/run/dbt_date/models/example_models/dates.sql

Additional details / screenshot

I suspect that the issue stems from the commit 709f7f6

Hi @milesvant! Sorry you're running into this issue. I had actually disabled all example models (at least for the time being until I figure out how to better make them work cross-platform), so this didn't come up during testing. Did you explicitly re-enable them?

enabled: false

I'm able to run the integrations tests for dbt-expectations against BigQuery and Snowflake fine using the 0.2.4 version of dbt-date since those example models should not get compiled or run.
I'm using dbt 0.19, not sure that makes a difference?

FYI, dbt-date should have no runnable models in the base package (other than integration test models in the sub-project)

dbt-date git:(main) ✗ dbt run
Running with dbt=0.19.0
Found 0 models, 0 tests, 0 snapshots, 0 analyses, 423 macros, 0 operations, 0 seed files, 0 sources, 0 exposures
WARNING: Nothing to do. Try checking your model configs and model specification args

Thanks for your quick response, and for pointing out that configuration! Looks like we enable all models by default in the top level dbt_project.yml which overrode the configuration for this dependency. We can fix our config to avoid pulling in this disabled model in the future.

Even so, the underlying problem is that the 'get_date_dimension' macro in v0.2.4 seems to be no longer compatible with BigQuery. I'm not sure if this covered by your integration tests. The macro from v0.2.3 worked so you could probably use that as the BigQuery adapter-specific version.

@milesvant glad you figured out the config issue!
I'll keep this issue open and try to fix this BQ issue by next week. Thanks!

Hi @clausherther ,

Please check my PR it should resolve this issue and allow to generate dim_date in Google Bigquery
#17

Thanks again @VasiliiSurov for fixing this. I'll cut a new release later today.