Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions packages/cubejs-backend-shared/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,17 @@ const variables: Record<string, (...args: any) => any> = {
return val;
},

/**
* Flag to disable driver's test connection probes
*/
dbDisableTestConnection: ({
dataSource
}: {
dataSource: string,
}) => (
!!process.env[keyByDataSource('CUBEJS_DB_DISABLE_TEST_CONNECTION', dataSource)]
),

/**
* Database max pool size.
*/
Expand All @@ -500,7 +511,7 @@ const variables: Record<string, (...args: any) => any> = {
),

/**
* Max polling interval. Currenly used in BigQuery and Databricks.
* Max polling interval. Currently used in BigQuery and Databricks.
* TODO: clarify this env.
*/
dbPollMaxInterval: ({
Expand All @@ -514,7 +525,7 @@ const variables: Record<string, (...args: any) => any> = {
},

/**
* Polling timeout. Currenly used in BigQuery, Dremio and Athena.
* Polling timeout. Currently used in BigQuery, Dremio and Athena.
* TODO: clarify this env.
*/
dbPollTimeout: ({
Expand All @@ -532,7 +543,7 @@ const variables: Record<string, (...args: any) => any> = {
},

/**
* Query timeout. Currenly used in BigQuery, Dremio, Postgres, Snowflake
* Query timeout. Currently used in BigQuery, Dremio, Postgres, Snowflake
* and Athena drivers and the orchestrator (queues, pre-aggs). For the
* orchestrator this variable did not split by the datasource.
*
Expand Down
14 changes: 13 additions & 1 deletion packages/cubejs-base-driver/src/BaseDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,12 @@ const DbTypeValueMatcher: Record<string, ((v: any) => boolean)> = {
* Base driver class.
*/
export abstract class BaseDriver implements DriverInterface {
private testConnectionTimeoutValue = 10000;
private readonly testConnectionTimeoutValue: number = 10000;

protected logger: any;

protected isTestConnectionDisabledFlag: boolean = false;

/**
* Class constructor.
*/
Expand All @@ -184,8 +186,14 @@ export abstract class BaseDriver implements DriverInterface {
* request before determining it as not valid. Default - 10000 ms.
*/
testConnectionTimeout?: number,

/**
* Flag for serverless DWHs to omit test connection probes.
*/
isTestConnectionDisabled?: boolean,
} = {}) {
this.testConnectionTimeoutValue = _options.testConnectionTimeout || 10000;
this.isTestConnectionDisabledFlag = _options.isTestConnectionDisabled || false;
}

protected informationSchemaQuery() {
Expand Down Expand Up @@ -680,6 +688,10 @@ export abstract class BaseDriver implements DriverInterface {
query.query = `SELECT * FROM (${query.query}) AS t LIMIT ${query.limit}`;
}

public isTestConnectionDisabled(): boolean {
return !!this.isTestConnectionDisabledFlag;
}

/**
* Returns an array of signed AWS S3 URLs of the unloaded csv files.
*/
Expand Down
Loading