Skip to content

Commit cef0714

Browse files
authored
chore: Align drivers methods signatures (add overrides to public/protected driver methods) (#9094)
1 parent f17fdac commit cef0714

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

packages/cubejs-base-driver/src/BaseDriver.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,20 +470,20 @@ export abstract class BaseDriver implements DriverInterface {
470470
}
471471
}
472472

473-
public getSchemas() {
473+
public getSchemas(): Promise<QuerySchemasResult[]> {
474474
const query = this.getSchemasQuery();
475475
return this.query<QuerySchemasResult>(query);
476476
}
477477

478-
public getTablesForSpecificSchemas(schemas: QuerySchemasResult[]) {
478+
public getTablesForSpecificSchemas(schemas: QuerySchemasResult[]): Promise<QueryTablesResult[]> {
479479
const schemasPlaceholders = schemas.map((_, idx) => this.param(idx)).join(', ');
480480
const schemaNames = schemas.map(s => s.schema_name);
481481

482482
const query = this.getTablesForSpecificSchemasQuery(schemasPlaceholders);
483483
return this.query<QueryTablesResult>(query, schemaNames);
484484
}
485485

486-
public async getColumnsForSpecificTables(tables: QueryTablesResult[]) {
486+
public async getColumnsForSpecificTables(tables: QueryTablesResult[]): Promise<QueryColumnsResult[]> {
487487
const groupedBySchema: Record<string, string[]> = {};
488488
tables.forEach((t) => {
489489
if (!groupedBySchema[t.schema_name]) {

packages/cubejs-bigquery-driver/src/BigQueryDriver.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,14 @@ export class BigQueryDriver extends BaseDriver implements DriverInterface {
222222
return dataSetsColumns.reduce((prev, current) => Object.assign(prev, current), {});
223223
}
224224

225-
public async getSchemas(): Promise<QuerySchemasResult[]> {
225+
public override async getSchemas(): Promise<QuerySchemasResult[]> {
226226
const dataSets = await this.bigquery.getDatasets();
227227
return dataSets[0].filter((dataSet) => dataSet.id).map((dataSet) => ({
228228
schema_name: dataSet.id!,
229229
}));
230230
}
231231

232-
public async getTablesForSpecificSchemas(schemas: QuerySchemasResult[]): Promise<QueryTablesResult[]> {
232+
public override async getTablesForSpecificSchemas(schemas: QuerySchemasResult[]): Promise<QueryTablesResult[]> {
233233
try {
234234
const allTablePromises = schemas.map(async schema => {
235235
const tables = await this.getTablesQuery(schema.schema_name);
@@ -247,7 +247,7 @@ export class BigQueryDriver extends BaseDriver implements DriverInterface {
247247
}
248248
}
249249

250-
public async getColumnsForSpecificTables(tables: QueryTablesResult[]): Promise<QueryColumnsResult[]> {
250+
public override async getColumnsForSpecificTables(tables: QueryTablesResult[]): Promise<QueryColumnsResult[]> {
251251
try {
252252
const allColumnPromises = tables.map(async table => {
253253
const tableName = `${table.schema_name}.${table.table_name}`;

packages/cubejs-redshift-driver/src/RedshiftDriver.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class RedshiftDriver extends PostgresDriver<RedshiftDriverConfiguration>
103103
/**
104104
* @override
105105
*/
106-
protected informationSchemaQuery() {
106+
protected override informationSchemaQuery() {
107107
return `
108108
SELECT columns.column_name as ${this.quoteIdentifier('column_name')},
109109
columns.table_name as ${this.quoteIdentifier('table_name')},
@@ -119,7 +119,7 @@ export class RedshiftDriver extends PostgresDriver<RedshiftDriverConfiguration>
119119
* so it needs to be queried separately.
120120
* @override
121121
*/
122-
public async tablesSchema(): Promise<DatabaseStructure> {
122+
public override async tablesSchema(): Promise<DatabaseStructure> {
123123
const query = this.informationSchemaQuery();
124124
const tablesSchema = await this.query(query, []).then(data => data.reduce<DatabaseStructure>(this.informationColumnsSchemaReducer, {}));
125125

@@ -155,7 +155,7 @@ export class RedshiftDriver extends PostgresDriver<RedshiftDriverConfiguration>
155155
/**
156156
* @override
157157
*/
158-
protected getSchemasQuery() {
158+
protected override getSchemasQuery() {
159159
return `
160160
SELECT table_schema as ${this.quoteIdentifier('schema_name')}
161161
FROM information_schema.tables
@@ -170,15 +170,15 @@ export class RedshiftDriver extends PostgresDriver<RedshiftDriverConfiguration>
170170
* It returns regular schemas (queryable from information_schema) and external ones.
171171
* @override
172172
*/
173-
public async getSchemas(): Promise<QuerySchemasResult[]> {
173+
public override async getSchemas(): Promise<QuerySchemasResult[]> {
174174
const schemas = await this.query<QuerySchemasResult>(`SHOW SCHEMAS FROM DATABASE ${this.dbName}`, []);
175175

176176
return schemas
177177
.filter(s => !IGNORED_SCHEMAS.includes(s.schema_name))
178178
.map(s => ({ schema_name: s.schema_name }));
179179
}
180180

181-
public async getTablesForSpecificSchemas(schemas: QuerySchemasResult[]): Promise<QueryTablesResult[]> {
181+
public override async getTablesForSpecificSchemas(schemas: QuerySchemasResult[]): Promise<QueryTablesResult[]> {
182182
const tables = await super.getTablesForSpecificSchemas(schemas);
183183

184184
// We might request the external schemas and tables, their descriptions won't be returned
@@ -195,7 +195,7 @@ export class RedshiftDriver extends PostgresDriver<RedshiftDriverConfiguration>
195195
return tables;
196196
}
197197

198-
public async getColumnsForSpecificTables(tables: QueryTablesResult[]): Promise<QueryColumnsResult[]> {
198+
public override async getColumnsForSpecificTables(tables: QueryTablesResult[]): Promise<QueryColumnsResult[]> {
199199
const columns = await super.getColumnsForSpecificTables(tables);
200200

201201
// We might request the external tables, their descriptions won't be returned
@@ -245,7 +245,7 @@ export class RedshiftDriver extends PostgresDriver<RedshiftDriverConfiguration>
245245
* And querying even system tables is billed.
246246
* @override
247247
*/
248-
public async testConnection() {
248+
public override async testConnection() {
249249
const conn = await this.pool.connect();
250250
conn.release();
251251
}

0 commit comments

Comments
 (0)