Skip to content

Commit cbf4620

Browse files
authored
feat(prestodb-driver): Add schema filter to informationSchemaQuery (#6382) Thanks @maatumo !
1 parent 97cc89b commit cbf4620

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

packages/cubejs-prestodb-driver/src/PrestoDriver.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,13 @@ export class PrestoDriver extends BaseDriver implements DriverInterface {
172172
return super.downloadQueryResults(query, values, options);
173173
}
174174

175+
public informationSchemaQuery() {
176+
if (this.config.schema) {
177+
return `${super.informationSchemaQuery()} AND columns.table_schema = '${this.config.schema}'`;
178+
}
179+
return super.informationSchemaQuery();
180+
}
181+
175182
public normalizeResultOverColumns(data: any[], columns: TableStructure) {
176183
const columnNames = map(prop('name'), columns || []);
177184
const arrayToObject = zipObj(columnNames);

packages/cubejs-prestodb-driver/test/presto-driver.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,12 @@ describe('PrestoHouseDriver', () => {
7474
await driver.testConnection();
7575
});
7676
});
77+
78+
// eslint-disable-next-line func-names
79+
it('should test informationSchemaQuery', async () => {
80+
await doWithDriver(async (driver: any) => {
81+
const informationSchemaQuery=driver.informationSchemaQuery();
82+
expect(informationSchemaQuery).toContain("columns.table_schema = 'sf1'");
83+
});
84+
});
7785
});

0 commit comments

Comments
 (0)