dbt-labs / dbt-snowflake

dbt-snowflake contains all of the code enabling dbt to work with Snowflake
https://getdbt.com
Apache License 2.0
296 stars 176 forks source link

[Bug] target_lag < 1 minute throws an error #1217

Closed noel closed 4 weeks ago

noel commented 1 month ago

Is this a new bug in dbt-snowflake?

Current Behavior

According to the official dbt docs, target_lag of < 1 minute should be possible, but when I try this in dbt-snowflake==1.8.4 I get the following error:

002755 (22023): SQL compilation error: Invalid TARGET_LAG value '30 seconds'. Dynamic Tables do not support lag values under 60 second(s).

Expected Behavior

30 second target lag should work

Steps To Reproduce

Create a model with the following configuration:

{{ config(
    materialized = 'dynamic_table',
    snowflake_warehouse = '<my_wh>',
    target_lag = '30 seconds',
) }}

run the model

Relevant log output

002755 (22023): SQL compilation error: Invalid TARGET_LAG value '30 seconds'. Dynamic Tables do not support lag values under 60 second(s).

### Environment

```markdown
- OS: Linux
- Python: 3.10.12
- dbt-core: 1.8.7
- dbt-snowflake: 1.8.4

Additional Context

No response

amychen1776 commented 4 weeks ago

Hi @noel , Snowflake does not support a lag of less than 1 minute. It's in their official documentation https://docs.snowflake.com/en/sql-reference/sql/alter-dynamic-table

Due to this - I'm closing this issue out. I'll make a note in our documentation to be clear that while 30 minutes is supported, 30 seconds (and anything under a minute) is not due to Snowflake's limitations.

noel commented 4 weeks ago

oh, thank you for clarifying, I had not seen this

The minimum value is 1 minute. If a dynamic table A depends on another dynamic table B, the minimum lag for A must be greater than or equal to the lag for B.

So I guess the point of seconds is to be able to do something like 90 seconds not as I tried to do with 30

amychen1776 commented 4 weeks ago

That's correct!