-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/snowflake destination #414
Conversation
✅ Deploy Preview for dlt-hub-docs canceled.
|
"bool": "BOOLEAN", | ||
"date": "DATE", | ||
"timestamp": "TIMESTAMP_TZ", | ||
"bigint": f"NUMBER({BIGINT_PRECISION}, 0)", # Snowflake has no integer types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amazing 🤷
dlt/common/data_writers/escape.py
Outdated
def escape_snowflake_identifier(v: str) -> str: | ||
# Snowcase uppercase all identifiers unless quoted. Match this here so queries on information schema work without issue | ||
# See also https://docs.snowflake.com/en/sql-reference/identifiers-syntax#double-quoted-identifiers | ||
return v.upper() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we asked our snowflake buddies what they use typically. let's see what they say
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to take into account escaping sql keywords also, e.g. : CREATE TABLE xxx (FROM VARCHAR)
Thinking now we should both quote and upcase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems that people mostly ignore it: use the original casing without quotes. this of course translates to upper case internally. that for example makes dbt packages to look identical for different systems. I'm still waiting for more input. sql keywords? aren't they case insensitive as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean with keywords if you have a column named from
or update
or something. Those need to be quoted.
So I think if we uppercase and quote in the escape function: some_column
-> "SOME_COLUMN"
makes things work pretty seamlessly, least resistance to how snowflake works.
Then queries with unquoted cols like SELECT some_column FROM ...
work since snowflake translates it to uppercase implicitly.
caps.escape_identifier = escape_snowflake_identifier | ||
caps.max_identifier_length = 255 | ||
caps.max_column_identifier_length = 255 | ||
caps.max_query_length = 32 * 1024 * 1024 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.snowflake.com/en/user-guide/query-size-limits so I'd put maybe 2MB
16b116a
to
8b36c9e
Compare
Avoids double compressing OR hardcoding the compression method of load file
@steinitzu for some reason snowflake tests are not running |
95bf350
to
cf41a53
Compare
closes #22