redis checkpoint

This commit is contained in:
Brian Cao 2022-08-26 20:21:53 -07:00
parent 10cc6616c5
commit 818f8721e9
10 changed files with 187 additions and 34 deletions

View file

@ -14,11 +14,15 @@ async function relationalQuery(websites, start_at) {
return runQuery(
prisma.session.findMany({
where: {
website: {
website_id: {
in: websites,
},
},
...(websites && websites.length > 0
? {
website: {
website_id: {
in: websites,
},
},
}
: {}),
created_at: {
gte: start_at,
},
@ -31,7 +35,6 @@ async function clickhouseQuery(websites, start_at) {
return clickhouse.rawQuery(
`
select
session_id,
session_uuid,
website_id,
created_at,
@ -43,8 +46,8 @@ async function clickhouseQuery(websites, start_at) {
"language",
country
from session
where website_id in (${websites.join[',']}
and created_at >= ${clickhouse.getDateFormat(start_at)})
where ${websites && websites.length > 0 ? `(website_id in (${websites.join[',']})` : '0 = 0'}
and created_at >= ${clickhouse.getDateFormat(start_at)}
`,
);
}