Unexplained syntax error related to limit {{num_days}} + 7

Metabase: v0.38.0.1
Google Chrome: Version 90.0.4430.212 (Official Build) (arm64)
OS: maxOS Big Sur 11.3.1
SQL: Snowflake

select *
from [any_table_name]
limit {{num_days}} + 7

This creates this unexplained syntax error: 30%20PM

When I connect to a postgres db, the above code works perfectly fine without the syntax error, but it does not work in Snowflake.

Hi @binh89
I think you need to report the problem to Snowflake, since this works select 1 limit 1, while this fails select 1 limit 1 + 1

I see. Thanks for the help! I'll do that.

I'm all set now. Thanks. As a workaround, I learned you could use Snowflake's QUALIFY such as

QUALIFY ROW_NUMBER() OVER (ORDER BY x) <= {{num_days}} + 7

1 Like