55 */
66
77import { PostgresDriver , PostgresDriverConfiguration } from '@cubejs-backend/postgres-driver' ;
8- import { BaseDriver , DownloadTableMemoryData , IndexesSQL , StreamOptions , StreamTableDataWithTypes , TableStructure } from '@cubejs-backend/base-driver' ;
8+ import {
9+ BaseDriver ,
10+ DatabaseStructure ,
11+ DownloadTableMemoryData ,
12+ IndexesSQL ,
13+ StreamOptions ,
14+ StreamTableDataWithTypes ,
15+ TableStructure
16+ } from '@cubejs-backend/base-driver' ;
917import { PoolClient , QueryResult } from 'pg' ;
10- import { reduce } from 'ramda' ;
1118import { Readable } from 'stream' ;
1219import semver from 'semver' ;
1320
@@ -18,16 +25,6 @@ export type ReadableStreamTableDataWithTypes = StreamTableDataWithTypes & {
1825 rowStream : Readable ;
1926} ;
2027
21- export type SchemaResponse = {
22- [ schema : string ] : {
23- [ schemaObject : string ] : {
24- name : string ;
25- type : string ;
26- attributes : any [ ] ;
27- } [ ] ;
28- }
29- } ;
30-
3128/**
3229 * Materialize driver class.
3330 */
@@ -73,6 +70,7 @@ export class MaterializeDriver extends PostgresDriver {
7370 /**
7471 * Application name to set for the connection.
7572 */
73+ // eslint-disable-next-line camelcase
7674 application_name ?: string ,
7775 } = { } ,
7876 ) {
@@ -175,11 +173,11 @@ export class MaterializeDriver extends PostgresDriver {
175173 return version . split ( ' ' ) [ 0 ] ;
176174 }
177175
178- public async tablesSchema ( ) : Promise < SchemaResponse > {
176+ public async tablesSchema ( ) : Promise < DatabaseStructure > {
179177 const version = await this . getMaterializeVersion ( ) ;
180178 const query = this . informationSchemaQueryWithFilter ( version ) ;
181179
182- return this . query ( query , [ ] ) . then ( data => reduce ( this . informationColumnsSchemaReducer , { } , data ) ) ;
180+ return this . query ( query , [ ] ) . then ( data => data . reduce < DatabaseStructure > ( this . informationColumnsSchemaReducer , { } ) ) ;
183181 }
184182
185183 protected async * asyncFetcher < R extends unknown > ( conn : PoolClient , cursorId : string ) : AsyncGenerator < R > {
0 commit comments