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 is case sensitive! #15

Open
pragi-balasubramanian-alation opened this issue Dec 16, 2020 · 0 comments
Open

Snowflake is case sensitive! #15

pragi-balasubramanian-alation opened this issue Dec 16, 2020 · 0 comments

Comments

@pragi-balasubramanian-alation
Copy link

Snowflake is case-insensitive if you use identifier without double quotes, But its case sensitive with double quotes.
(https://docs.snowflake.com/en/sql-reference/identifiers-syntax.html)

But data-knex-snowflake-dialect always emits query with columns that are in upper-case.

For example:

const connection = knex({
  client: SnowflakeDialect,
})

const builder = connection('TABLE1')
  .withSchema('SCHEMA1')
  .select({
       'Id': 'id'
  })

Expected: select "TABLE1"."id" as "Id" from "SCHEMA1"."TABLE1"
Actual: select "TABLE1"."ID" as "ID" from "SCHEMA1"."TABLE1"

Note: alias name and column name - both have to be case sensitive.

Workaround:

const builder = connection('TABLE1')
  .withSchema('SCHEMA1')
  .select([
    knex.ref(
        knex.raw('id')
    ).as(
        knex.raw('Id')
    )])

With this, I am able to make column name and alias however i want

@pragi-balasubramanian-alation pragi-balasubramanian-alation changed the title Snowflake case sensitive Snowflake is case sensitive! Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant