Skip to content

Conversation

@christianallred-nomi
Copy link

@christianallred-nomi christianallred-nomi commented Sep 3, 2024

Check List

  • Tests has been run in packages where changes made if available
  • Linter has been run for changed code
  • Tests for the changes have been added if not covered yet
  • Docs have been added / updated if required

Closes #7440

@christianallred-nomi christianallred-nomi requested a review from a team as a code owner September 3, 2024 18:18
@vercel
Copy link

vercel bot commented Sep 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
examples-angular-dashboard ⬜️ Ignored (Inspect) Visit Preview Sep 3, 2024 6:35pm
examples-react-d3 ⬜️ Ignored (Inspect) Visit Preview Sep 3, 2024 6:35pm
examples-react-dashboard ⬜️ Ignored (Inspect) Visit Preview Sep 3, 2024 6:35pm
examples-react-data-table ⬜️ Ignored (Inspect) Visit Preview Sep 3, 2024 6:35pm
examples-react-highcharts ⬜️ Ignored (Inspect) Visit Preview Sep 3, 2024 6:35pm
examples-react-material-ui ⬜️ Ignored (Inspect) Visit Preview Sep 3, 2024 6:35pm
examples-react-pivot-table ⬜️ Ignored (Inspect) Visit Preview Sep 3, 2024 6:35pm
examples-vue-query-builder ⬜️ Ignored (Inspect) Visit Preview Sep 3, 2024 6:35pm

@github-actions github-actions bot added the pr:community Contribution from Cube.js community members. label Sep 3, 2024
@christianallred-nomi christianallred-nomi force-pushed the fix(snowflake)fixing-undefined-case-in-snowflake branch 2 times, most recently from 85d3857 to 528129e Compare September 3, 2024 18:26
@christianallred-nomi christianallred-nomi force-pushed the fix(snowflake)fixing-undefined-case-in-snowflake branch from 528129e to e6f81bb Compare September 3, 2024 18:34
@igorlukanin
Copy link
Member

Hi @christianallred-nomi 👋

Thanks for your contribution! Do you think this is a breaking change?

@christianallred
Copy link

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:

@christianallred
Copy link

An alternate decision that would not require a session update would be to update the snowflake driver to overwrite the result parser function

@paveltiunov
Copy link
Member

@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.

@christianallred
Copy link

@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 :)

@mattssll
Copy link

@paveltiunov any info about this? I'm having issue with the undefined in snowflake
#7440

@paveltiunov
Copy link
Member

@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.

@KSDaemon
Copy link
Member

KSDaemon commented Dec 6, 2024

@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 initConnection(), or simply pass as arg to execute.

if (this.ignoreCase) {
   await this.execute(connection, 'ALTER SESSION SET QUOTED_IDENTIFIERS_IGNORE_CASE = FALSE', [], false);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:community Contribution from Cube.js community members.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Loading database schema from Snowflake fails in some cases

6 participants