split db files

This commit is contained in:
Brian Cao 2022-08-25 22:04:32 -07:00
parent 46b4b98d40
commit bb50753704
36 changed files with 496 additions and 454 deletions

View file

@ -1,11 +1,7 @@
import { CLICKHOUSE, RELATIONAL } from 'lib/constants';
import {
rawQueryClickhouse,
getDateFormatClickhouse,
prisma,
runAnalyticsQuery,
runQuery,
} from 'lib/db';
import { prisma, runQuery } from 'lib/db/relational';
import clickhouse from 'lib/clickhouse';
import { runAnalyticsQuery } from 'lib/db/db';
export function getEvents(...args) {
return runAnalyticsQuery({
@ -32,7 +28,7 @@ function relationalQuery(websites, start_at) {
}
function clickhouseQuery(websites, start_at) {
return rawQueryClickhouse(
return clickhouse.rawQuery(
`
select
event_id,
@ -43,7 +39,7 @@ function clickhouseQuery(websites, start_at) {
event_name
from event
where website_id in (${websites.join[',']}
and created_at >= ${getDateFormatClickhouse(start_at)})
and created_at >= ${clickhouse.getDateFormat(start_at)})
`,
);
}