Skip to content
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

Snowflake sqlify issue #1632

Closed
AvivVegh opened this issue Oct 22, 2023 · 5 comments
Closed

Snowflake sqlify issue #1632

AvivVegh opened this issue Oct 22, 2023 · 5 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@AvivVegh
Copy link

AvivVegh commented Oct 22, 2023

Using function sqlify for Snowflake
...
const sql = 'select NAME as "a\b" from schmea.table'
const ast = parser.astify(sql, { database: 'Snowflake' })
const parsedSql = parser.sqlify(sql, { database: 'Snowflake' })
console.log(parsedSql)

expected: select "NAME" as "a\b" from "schmea"."table"
actual: select "NAME" as `a\b` from "schmea"."table"

`a\b` is not valid in Snowflake

also in adding quotes you are losing the "Letter case"
the column/schema/table should be the exact name (with letter case) as it is in the warehouse.

can we do something with that ?

@taozhi8833998 taozhi8833998 added the bug Something isn't working label Oct 23, 2023
@taozhi8833998 taozhi8833998 added this to the 4.12.0 milestone Oct 23, 2023
@taozhi8833998
Copy link
Owner

taozhi8833998 commented Oct 23, 2023

two issues here:

  1. the alias is not identified by "
  2. losing the "letter case" when sqlify back

@taozhi8833998
Copy link
Owner

@AvivVegh the first issue has been fixed. working on the second one now.

@taozhi8833998
Copy link
Owner

@AvivVegh for the second issue, can you give me some cases to make it more clearly?

@AvivVegh
Copy link
Author

case sensitive example:

warehouse state:
table name: SRC_HOST
column name: name

const sql = 'select NAME from dev.src_host'

if Im running this query directly in the warehouse or in some db client
there is no case sensitive, but when the parser is adding quotes, we are losing this functionality

parser result:
select "NAME" from "dev"."src_host"

can we might add a flag to parser remove quotes ?

@taozhi8833998
Copy link
Owner

@AvivVegh OK, I got it, the second issue may be the same with #1607 , which I am working on. Since the first issue has been fixed, I will add future progress in #1607 for the second issue, and I close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants