Skip to content

Commit 6c78579

Browse files
committed
implement missed getTablesForSpecificSchemas()
1 parent cdb21be commit 6c78579

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,23 @@ export class RedshiftDriver extends PostgresDriver<RedshiftDriverConfiguration>
178178
.map(s => ({ schema_name: s.schema_name }));
179179
}
180180

181+
public async getTablesForSpecificSchemas(schemas: QuerySchemasResult[]): Promise<QueryTablesResult[]> {
182+
const tables = await super.getTablesForSpecificSchemas(schemas);
183+
184+
// We might request the external schemas and tables, their descriptions won't be returned
185+
// by the super.getTablesForSpecificSchemas(). Need to request them separately.
186+
const missedSchemas = schemas.filter(s => !tables.some(t => t.schema_name === s.schema_name));
187+
188+
for (const externalSchema of missedSchemas) {
189+
const tablesRes = await this.tablesForExternalSchema(externalSchema.schema_name);
190+
tablesRes.forEach(t => {
191+
tables.push({ schema_name: externalSchema.schema_name, table_name: t.table_name });
192+
});
193+
}
194+
195+
return tables;
196+
}
197+
181198
public async getColumnsForSpecificTables(tables: QueryTablesResult[]): Promise<QueryColumnsResult[]> {
182199
const columns = await super.getColumnsForSpecificTables(tables);
183200

0 commit comments

Comments
 (0)