Dbt: "year is out of range error" when loading results with the words "last month"

Created on 12 Jan 2020  路  3Comments  路  Source: fishtown-analytics/dbt

Describe the bug

This is such a weird bug, that I think it is best to just follow the reproduction steps. Note that I simplified the example as much as possible.

Steps To Reproduce

  1. Create a model (or analysis) that calls the following statement
$ cat models/problematic_model.sql
{%- call statement('values_has_month', fetch_result=true) %}

select
    'last month' as answer

{%- endcall -%}

{%- set value_list = load_result('values_has_month') -%}

select 1

  1. dbt run
$ dbt run
Running with dbt=0.15.0

Found 1 model, 0 tests, 0 snapshots, 0 analyses, 265 macros, 0 operations, 3 seed files, 0 sources

13:22:48 | Concurrency: 1 threads (target='dev_redshift')
13:22:48 |
13:22:48 | 1 of 1 START table model jaffle_shop_dev.problematic_model........... [RUN]
Unhandled error while executing model.jaffle_shop.problematic_model
year is out of range
13:22:53 | 1 of 1 ERROR creating table model jaffle_shop_dev.problematic_model.. [ERROR in 4.12s]
13:22:53 |
13:22:53 | Finished running 1 table model in 10.80s.

Completed with 1 error and 0 warnings:

year is out of range

Done. PASS=0 WARN=0 ERROR=1 SKIP=0 TOTAL=1

Expected behavior

No error

Screenshots and log output

Can share logs if required, but I'm pretty confident you'll be able to reproduce it yourself.

System information

Which database are you using dbt with?
have replicated on multiple databases:

  • [ ] postgres
  • [x] redshift
  • [x] bigquery
  • [x] snowflake
  • [ ] other (specify: ____________)

The output of dbt debug:

dbt debug
Running with dbt=0.15.0
dbt version: 0.15.0
python version: 3.7.5
python path: /usr/local/Cellar/[email protected]/0.15.0_1/libexec/bin/python3.7
os info: Darwin-19.2.0-x86_64-i386-64bit

Additional context

I don't think this is a bug in dbt (I suspect it's in Agate), but my debugging skillzzz are not good enough to figure out what's going on here.

BTW, this works:

{%- call statement('values_has_month', fetch_result=true) %}

select
    'month' as answer

{%- endcall -%}

{%- set value_list = load_result('values_has_month') -%}

select 1

Also happy for you to close this with a #wontfix, but I'd love to know what's happening here!

bug

Most helpful comment

This works fine on dev/barbara-gittings, and as @drewbanin noted this is exactly the kind of bug that #1920 fixed.

All 3 comments

Thanks for the report @clrcrl - I wonder if this is fixed by some of the agate work that we did for the Barbara Gittings release (eg. https://github.com/fishtown-analytics/dbt/pull/1920).

I'll try to repro

FYI: @emmacooperpeterson

This works fine on dev/barbara-gittings, and as @drewbanin noted this is exactly the kind of bug that #1920 fixed.

Was this page helpful?
0 / 5 - 0 ratings