@@ -144,8 +144,6 @@ export class ClickHouseDriver extends BaseDriver implements DriverInterface {
144144 const port = config . port ?? getEnv ( 'dbPort' , { dataSource } ) ?? 8123 ;
145145 const protocol = config . protocol ?? getEnv ( 'dbSsl' , { dataSource } ) ? 'https:' : 'http:' ;
146146 const url = `${ protocol } //${ host } :${ port } ` ;
147- // TODO drop this
148- console . log ( 'ClickHouseDriver will use url' , url ) ;
149147
150148 const username = getEnv ( 'dbUser' , { dataSource } ) ;
151149 const password = getEnv ( 'dbPass' , { dataSource } ) ;
@@ -181,7 +179,6 @@ export class ClickHouseDriver extends BaseDriver implements DriverInterface {
181179 }
182180
183181 protected withCancel < T > ( fn : ( con : ClickHouseClient , queryId : string , signal : AbortSignal ) => Promise < T > ) : Promise < T > {
184- console . log ( "withCancel call" ) ;
185182 const queryId = uuidv4 ( ) ;
186183
187184 const abortController = new AbortController ( ) ;
@@ -239,19 +236,13 @@ export class ClickHouseDriver extends BaseDriver implements DriverInterface {
239236 const response = await this . queryResponse ( query , values ) ;
240237 return this . normaliseResponse ( response ) ;
241238 } catch ( e ) {
242- const newError = new Error ( `Query failed: ${ query } ` , { cause : e } ) ;
243- console . log ( newError ) ;
244- throw newError ;
239+ throw new Error ( `Query failed: ${ query } ` , { cause : e } ) ;
245240 }
246241 }
247242
248243 protected queryResponse ( query : string , values : unknown [ ] ) : Promise < ResponseJSON < Record < string , unknown > > > {
249- console . log ( 'ClickHouse queryResponse call' , query ) ;
250-
251244 const formattedQuery = sqlstring . format ( query , values ) ;
252245
253- console . log ( 'ClickHouse queryResponse prepared' , formattedQuery ) ;
254-
255246 return this . withCancel ( async ( connection , queryId , signal ) => {
256247 const format = 'JSON' ;
257248
@@ -262,16 +253,13 @@ export class ClickHouseDriver extends BaseDriver implements DriverInterface {
262253 clickhouse_settings : this . config . clickhouseSettings ,
263254 abort_signal : signal ,
264255 } ) ;
265- console . log ( "queryResponse resultSet" , query , resultSet . query_id , resultSet . response_headers ) ;
266256
267257 if ( resultSet . response_headers [ 'x-clickhouse-format' ] !== format ) {
268258 throw new Error ( `Unexpected x-clickhouse-format in response: expected ${ format } , received ${ resultSet . response_headers [ 'x-clickhouse-format' ] } ` ) ;
269259 }
270260
271261 // We used format JSON, so we expect each row to be Record with column names as keys
272262 const results = await resultSet . json < Record < string , unknown > > ( ) ;
273- console . log ( "queryResponse json results" , query , results ) ;
274- console . log ( "queryResponse json results JSON" , JSON . stringify ( results ) ) ;
275263 return results ;
276264 } ) ;
277265 }
@@ -346,16 +334,12 @@ export class ClickHouseDriver extends BaseDriver implements DriverInterface {
346334 // eslint-disable-next-line @typescript-eslint/no-unused-vars
347335 { highWaterMark } : StreamOptions
348336 ) : Promise < StreamTableDataWithTypes > {
349- console . log ( 'ClickHouse stream call' , query , values ) ;
350-
351337 // Use separate client for this long-living query
352338 const client = this . createClient ( 1 ) ;
353339
354340 try {
355341 const formattedQuery = sqlstring . format ( query , values ) ;
356342
357- console . log ( 'ClickHouse stream prepared' , formattedQuery ) ;
358-
359343 const format = 'JSONCompactEachRowWithNamesAndTypes' ;
360344
361345 const resultSet = await client . query ( {
@@ -377,7 +361,6 @@ export class ClickHouseDriver extends BaseDriver implements DriverInterface {
377361 const allRowsIter = ( async function * allRowsIter ( ) {
378362 for await ( const rowsBatch of resultSetStream ) {
379363 for ( const row of rowsBatch ) {
380- console . log ( 'ClickHouse stream got row' , formattedQuery , row ) ;
381364 yield row . json ( ) ;
382365 }
383366 }
@@ -423,8 +406,7 @@ export class ClickHouseDriver extends BaseDriver implements DriverInterface {
423406 } ;
424407 } catch ( e ) {
425408 await client . close ( ) ;
426-
427- throw e ;
409+ throw new Error ( `Stream query failed: ${ query } ` , { cause : e } ) ;
428410 }
429411 }
430412
0 commit comments