-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(snowflake-driver): add ignore case statements flag #8899
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-driver): add ignore case statements flag #8899
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 8 Skipped Deployments
|
71040e4 to
6d01486
Compare
|
@mike-taylor-nomihealth Thanks for contributing! Could we please put it under the flag enabled by default? Thanks! |
I believe I got this all set up properly - let me know if this is not what you meant Also - just realized #8665 was the same fix, so I implemented it in the suggested format from that bug ticket. |
59837c2 to
c80d27a
Compare
2c834c5 to
2c5054b
Compare
2c5054b to
d2e2dd6
Compare
d2e2dd6 to
c6e56e6
Compare
Adds env var for the snowflake driver to enable or disable the case sensitivity and if not set will default to case insensitive
c6e56e6 to
d0bcf15
Compare
KSDaemon
left a comment
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.
Hi @mike-taylor-nomihealth!
Thank you for taking this up! Left some comments! WDYT?
| await this.execute(connection, 'ALTER SESSION SET TIMEZONE = \'UTC\'', [], false); | ||
| await this.execute(connection, `ALTER SESSION SET STATEMENT_TIMEOUT_IN_SECONDS = ${this.config.executionTimeout}`, [], false); | ||
|
|
||
| if (this.ignoreCase) { |
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 realized that we mess the value of our env CUBEJS_DB_SNOWFLAKE_QUOTED_IDENTIFIERS_IGNORE_CASE / this.ignoreCase and the value we pass to the Snowflake.
I mean — if we have true — we pass false and vice versa.
Maybe it would be better to align them. Possible options imho are:
- Rename our var to smth like
CUBEJS_DB_SNOWFLAKE_QUOTED_IDENTIFIERS_RESPECT_CASE. Then having it set totrue— means exactly what we set by this statement — not ignoring the case. - Or.... Use
CUBEJS_DB_SNOWFLAKE_QUOTED_IDENTIFIERS_IGNORE_CASEas is: if it is true — then — we should passtrueto Snowflake. In this case, don't forget to update the default value if var is not set, as we want respect case by default.
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.
Thought about this and even though it makes it a little bit janky to keep the CUBEJS_DB_SNOWFLAKE_QUOTED_IDENTIFIERS_IGNORE_CASE that matches the values passed so it matches the env var with the key/value that we're passing in the session - I think that's more straightforward even though it does mean we have the default behavior always hitting that logic path for a !this.ignoreCase
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.
Are we absolutely we sure we want to respect case by default for the snowflake driver given that they made the change to ignore it and upper() everthing? It seems non-intuitive that their driver doesn't default to case insensitive when that's the behavior of their UI and everything in between, so if we set the default behavior to be case sensitive it feels like there are a lot of folks using this driver that are going to have to set a value explicitly when the default behavior probably should reflect how snowflake is using it (even if they didn't update their driver settings to reflect that by default.).
I made the change in the PR but am just playing devils advocate here, because it seems like we got here because this ISN'T the default behavior but probably should be because of how SNOWFLAKE decided to update their behaviors.
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.
Well, I agree with you in general. The idea is first to put this behind the flag and later enable it by default.
|
Gentle ping @mike-taylor-nomihealth! |
9b72949 to
29bc2fc
Compare
| exportBucket: this.getExportBucket(dataSource), | ||
| resultPrefetch: 1, | ||
| executionTimeout: getEnv('dbQueryTimeout', { dataSource }), | ||
| ignoreCase: getEnv('snowflakeQuotedIdentIgnoreCase', { dataSource }), |
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.
here you set ignoreCase, while SnowflakeDriverOptions type has caseSensitiveIdentifiers?: boolean
| resultPrefetch?: number, | ||
| exportBucket?: SnowflakeDriverExportBucket, | ||
| executionTimeout?: number, | ||
| caseSensitiveIdentifiers?: boolean, |
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.
| caseSensitiveIdentifiers?: boolean, | |
| identIgnoreCase?: boolean, |
| exportBucket: this.getExportBucket(dataSource), | ||
| resultPrefetch: 1, | ||
| executionTimeout: getEnv('dbQueryTimeout', { dataSource }), | ||
| ignoreCase: getEnv('snowflakeQuotedIdentIgnoreCase', { dataSource }), |
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.
| ignoreCase: getEnv('snowflakeQuotedIdentIgnoreCase', { dataSource }), | |
| identIgnoreCase: getEnv('snowflakeQuotedIdentIgnoreCase', { dataSource }), |
|
|
||
| // We only want to ignore the case if someone sets the value to false explicitly since the default assumption | ||
| // is that casing matters | ||
| if (!this.ignoreCase) { |
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.
| if (!this.ignoreCase) { | |
| if (!this.identIgnoreCase) { |
|
Okay... I took it into my own hands.: #9131. |
Check List
Closes #7440
Supersedes #8765