Skip to content

Commit

Permalink
Set query_id to be the consumption path (#1824)
Browse files Browse the repository at this point in the history
* add query ids

* remove console log and accidnetal deletion
  • Loading branch information
georgevanderson authored Oct 10, 2024
1 parent 9d3335a commit 2d49dfd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/ts-moose-lib/src/consumption-apis/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ function emptyIfUndefined(value: string | undefined): string {

export class MooseClient {
client: ClickHouseClient;

constructor(client: ClickHouseClient) {
query_id: string;
constructor(client: ClickHouseClient, query_id: string) {
this.client = client;
this.query_id = query_id;
}

async query(sql: Sql) {
Expand Down Expand Up @@ -161,6 +162,7 @@ export class MooseClient {
query,
query_params,
format: "JSONEachRow",
query_id: this.query_id,
});
}
}
Expand Down
5 changes: 4 additions & 1 deletion packages/ts-moose-lib/src/consumption-apis/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ const apiHandler =
const userFuncModule = require(pathName);

const result = await userFuncModule.default(paramsObject, {
client: new MooseClient(getClickhouseClient(clickhouseConfig)),
client: new MooseClient(
getClickhouseClient(clickhouseConfig),
fileName,
),
sql: sql,
jwt: jwtPayload,
});
Expand Down

0 comments on commit 2d49dfd

Please sign in to comment.