-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix(snowflake): fixing the snowflake schema fetcher logic (#7440) #8665
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
fix(snowflake): fixing the snowflake schema fetcher logic (#7440) #8665
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 8 Skipped Deployments
|
85d3857 to
528129e
Compare
528129e to
e6f81bb
Compare
|
Thanks for your contribution! Do you think this is a breaking change? |
|
It should not be no. A while ago snowflake made a decision to always cap case their responses. This caused an Outage for us. And is what causes the bug this or is aiming to fix with cube. The fact that this is working for some snowflake users means they have this setting set globally instead of by session. I liked this solution because it fixes the problem for affected users but should leave the existing users the same. I have not had time to test this 100% however so if someone with a working snowflake instance can test it, that would be great: |
|
An alternate decision that would not require a session update would be to update the snowflake driver to overwrite the result parser function |
|
@christianallred Thanks for contributing it! I think it's definitely great feature however as of now it should go under the flag which we'd enable by default going forward. |
Whatever y'all decide is fine. It’s just broken for our use case until a fix is decided on. FWIW I don’t really have skin in the game anymore as I am leaving the org that was looking at cube as a solution. Cheers :) |
|
@paveltiunov any info about this? I'm having issue with the undefined in snowflake |
|
@mattssll We're open for this change if it'd land under the flag. If you have capacity to fix PR we'd be happy to merge it. |
|
@christianallred-nomi if you don't know, here are a few tips on how to add flag. It's pretty easy! Add a new env in env.ts, something like: /**
* Snowflake flag controlling QUOTED_IDENTIFIERS_IGNORE_CASE.
* Defaults to FALSE if not set
*/
snowflakeQuotedIdentIgnoreCase: ({
dataSource
}: {
dataSource: string,
}) => (
const val = process.env[
keyByDataSource(
'CUBEJS_DB_SNOWFLAKE_QUOTED_IDENTIFIERS_IGNORE_CASE',
dataSource,
)
];
if (val) {
if (val.toLocaleLowerCase() === 'true') {
return true;
} else if (val.toLowerCase() === 'false') {
return false;
} else {
throw new TypeError(
`The ${
keyByDataSource(
'CUBEJS_DB_SNOWFLAKE_QUOTED_IDENTIFIERS_IGNORE_CASE',
dataSource,
)
} must be either 'true' or 'false'.`
);
}
} else {
return false;
}
),Then read and store the flag value in driver's [constructor](https://github.com/cube-js/cube/blob/master/packages/cubejs-snowflake-driver/src/SnowflakeDriver.ts#L253, smth like: this.ignoreCase = getEnv('snowflakeQuotedIdentIgnoreCase', { dataSource })And check it in the if (this.ignoreCase) {
await this.execute(connection, 'ALTER SESSION SET QUOTED_IDENTIFIERS_IGNORE_CASE = FALSE', [], false);
} |
Check List
Closes #7440