Re-write CH queries to use query params.

This commit is contained in:
Brian Cao 2023-01-12 00:02:12 -08:00
parent b4bd988e4e
commit 1eb9e10d94
12 changed files with 81 additions and 100 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));