mirror of
https://github.com/umami-software/umami.git
synced 2026-02-15 18:15:35 +01:00
Re-write CH queries to use query params.
This commit is contained in:
parent
9a7385e4d5
commit
befc5cf6c0
12 changed files with 114 additions and 125 deletions
|
|
@ -68,15 +68,19 @@ async function clickhouseQuery(
|
|||
const { startDate, endDate, column, filters = {} } = data;
|
||||
const { rawQuery, parseFilters, getBetweenDates } = clickhouse;
|
||||
const website = await cache.fetchWebsite(websiteId);
|
||||
const params = [websiteId, website?.revId || 0, EVENT_TYPE.pageView];
|
||||
const params = {
|
||||
websiteId,
|
||||
revId: website?.revId || 0,
|
||||
eventType: EVENT_TYPE.pageView,
|
||||
};
|
||||
const { filterQuery } = parseFilters(filters, params);
|
||||
|
||||
return rawQuery(
|
||||
`select ${column} x, count(*) y
|
||||
from event
|
||||
where website_id = $1
|
||||
and rev_id = $2
|
||||
and event_type = $3
|
||||
where website_id = {websiteId:UUID}
|
||||
and rev_id = {revId:UInt32}
|
||||
and event_type = {eventType:UInt32}
|
||||
and ${getBetweenDates('created_at', startDate, endDate)}
|
||||
${filterQuery}
|
||||
group by x
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue