Skip to content

Commit

Permalink
Refactor Snowflake parameters into flags, and revert those parameters…
Browse files Browse the repository at this point in the history
… to their defaults. (#1011)

* Refactor Snowflake parameters into flags, and revert those parameters to their defaults.

* turn off OCSP in cloud build

* Revert "turn off OCSP in cloud build"

This reverts commit 8259049.

* fixes
  • Loading branch information
BenBirt authored Sep 28, 2020
1 parent 6a9773c commit 9610da3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ts_library(
deps = [
"//api/utils",
"//common/errors",
"//common/flags",
"//common/strings",
"//core",
"//protos:ts",
Expand Down
13 changes: 8 additions & 5 deletions api/dbadapters/snowflake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ import { IDbAdapter, IDbClient, OnCancel } from "df/api/dbadapters/index";
import { parseSnowflakeEvalError } from "df/api/utils/error_parsing";
import { LimitedResultSet } from "df/api/utils/results";
import { ErrorWithCause } from "df/common/errors/errors";
import { Flags } from "df/common/flags";
import { collectEvaluationQueries, QueryOrAction } from "df/core/adapters";
import { dataform } from "df/protos/ts";

const HEARTBEAT_INTERVAL_SECONDS = 30;

const flags = {
snowflakeLogLevel: Flags.string("snowflake-log-level", "info"),
snowflakeUseOcsp: Flags.boolean("snowflake-use-ocsp", true)
};

// This is horrible. However, it allows us to set the 'APPLICATION' parameter on client.environment,
// which is passed all the way through to Snowflake's connection code. Pending a fix for
// https://github.com/snowflakedb/snowflake-connector-nodejs/issues/100, this is the only way
Expand All @@ -30,11 +36,8 @@ const snowflake = require("snowflake-sdk/lib/core")({
}) as ISnowflake;

snowflake.configure({
logLevel: "trace",
// Turn off OCSP checking. It appears as though timeouts in OCSP checks cause failed runs.
// See https://community.snowflake.com/s/case/5003r00001JuQrGAAV/snowflake-network-connectivity-problems
// for support ticket.
insecureConnect: true
logLevel: flags.snowflakeLogLevel.get(),
insecureConnect: !flags.snowflakeUseOcsp.get()
});

interface ISnowflake {
Expand Down
1 change: 1 addition & 0 deletions tests/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ ts_test_suite(
"//tests/integration/sqldatawarehouse_project:files",
"//tests/integration/sqldatawarehouse_project:node_modules",
],
templated_args = ["--snowflake-use-ocsp=false"],
deps = [
"//api",
"//api/utils",
Expand Down

0 comments on commit 9610da3

Please sign in to comment.