Keboola WIKI‎ > ‎Old Articles‎ > ‎Transformations‎ > ‎Snowflake‎ > ‎

Redshift > Snowflake

Basic hints for moving from Redshift to Snowflake

Change backtick ` to double-quote "

Redshift:
SELECT * FROM `in.c-main.table`

Snowflake:
SELECT * FROM "in.c-main.table"

Current timestamp

In Redshift, you have to use GETDATE() or SYSDATE for current time. Snowflake has CURRENT_TIMESTAMP().

Redshift - rows where mydate is not older than last 7 days:
SELECT * FROM `in.c-main.table` WHERE mydate >= SYSDATE - 7

Snowflake - rows where mydate is not older than last 7 days:
SELECT * FROM "in.c-main.table" WHERE "mydate" >= DATEADD(day,-7,CURRENT_TIMESTAMP());

Format timestamp

format unix timestamp to formated date:

TO_VARCHAR("availableTo"::TIMESTAMP, 'yyyy-mm-dd hh:mi:ss')
Comments