Re-write CH queries to use query params.

This commit is contained in:
Brian Cao 2023-01-12 12:06:25 -08:00
parent 9a7385e4d5
commit befc5cf6c0
12 changed files with 114 additions and 125 deletions

View file

@ -18,7 +18,7 @@ async function relationalQuery(where: Prisma.SessionWhereUniqueInput) {
async function clickhouseQuery({ id: sessionId }: { id: string }) {
const { rawQuery, findFirst } = clickhouse;
const params = [sessionId];
const params = { sessionId };
return rawQuery(
`select
@ -33,7 +33,7 @@ async function clickhouseQuery({ id: sessionId }: { id: string }) {
language,
country
from event
where session_id = $1
where session_id = {sessionId:UUID}
limit 1`,
params,
).then(result => findFirst(result));