Skip to content

Commit 528129e

Browse files
fix(snowflake): fixing the snowflake schema fetcher logic (#7440)
1 parent b9521e4 commit 528129e

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

docs/pages/product/configuration/data-sources/snowflake.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ redirect_from:
1212
- [The region][snowflake-docs-regions] for the [Snowflake][snowflake] warehouse
1313
- The username/password for the [Snowflake][snowflake] account
1414

15+
## Snowflake quoted identifiers
16+
17+
Due to an issue in snowflakes opinion about quoted identifers we set a session value to override
18+
snowflake defaults for users that have set an account value for: QUOTED_IDENTIFIERS_IGNORE_CASE
19+
you can learn more about this here: https://docs.snowflake.com/en/sql-reference/identifiers-syntax#double-quoted-identifiers
20+
1521
## Setup
1622

1723
### Manual

packages/cubejs-snowflake-driver/src/SnowflakeDriver.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
DownloadQueryResultsResult,
2323
DownloadQueryResultsOptions,
2424
DriverCapabilities,
25-
QueryTablesResult,
2625
} from '@cubejs-backend/base-driver';
2726
import { formatToTimeZone } from 'date-fns-timezone';
2827
import { Storage } from '@google-cloud/storage';
@@ -356,7 +355,14 @@ export class SnowflakeDriver extends BaseDriver implements DriverInterface {
356355

357356
await this.execute(connection, 'ALTER SESSION SET TIMEZONE = \'UTC\'', [], false);
358357
await this.execute(connection, `ALTER SESSION SET STATEMENT_TIMEOUT_IN_SECONDS = ${this.config.executionTimeout}`, [], false);
359-
358+
/**
359+
* Because snowflake has an opinion about the shape of data returns over the api.
360+
* we have to set this value to false in order for our schema requests to succeed.
361+
*
362+
* You can learn more here.
363+
* https://docs.snowflake.com/en/sql-reference/identifiers-syntax#double-quoted-identifiers
364+
*/
365+
await this.execute(connection, 'ALTER SESSION SET QUOTED_IDENTIFIERS_IGNORE_CASE = FALSE', [], false);
360366
return connection;
361367
} catch (e) {
362368
this.connection = null;

0 commit comments

Comments
 (0)