mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 09:05:36 +01:00
add event name to properties table
This commit is contained in:
parent
04de691893
commit
aaf9adacc6
5 changed files with 44 additions and 16 deletions
|
|
@ -24,14 +24,15 @@ async function relationalQuery(
|
|||
return rawQuery(
|
||||
`
|
||||
select
|
||||
event_name as "eventName",
|
||||
data_key as "propertyName",
|
||||
count(*) as "total"
|
||||
from event_data
|
||||
where website_id = {{websiteId::uuid}}
|
||||
and created_at between {{startDate}} and {{endDate}}
|
||||
${filterQuery}
|
||||
group by data_key
|
||||
order by 2 desc
|
||||
group by event_name, data_key
|
||||
order by 3 desc
|
||||
limit 500
|
||||
`,
|
||||
params,
|
||||
|
|
@ -41,7 +42,7 @@ async function relationalQuery(
|
|||
async function clickhouseQuery(
|
||||
websiteId: string,
|
||||
filters: QueryFilters & { propertyName?: string },
|
||||
): Promise<{ propertyName: string; dataType: number; propertyValue: string; total: number }[]> {
|
||||
): Promise<{ eventName: string; propertyName: string; total: number }[]> {
|
||||
const { rawQuery, parseFilters } = clickhouse;
|
||||
const { filterQuery, params } = await parseFilters(websiteId, filters, {
|
||||
columns: { propertyName: 'data_key' },
|
||||
|
|
@ -50,23 +51,23 @@ async function clickhouseQuery(
|
|||
return rawQuery(
|
||||
`
|
||||
select
|
||||
event_name as eventName,
|
||||
data_key as propertyName,
|
||||
count(*) as total
|
||||
from event_data
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||
${filterQuery}
|
||||
group by data_key
|
||||
order by 2 desc
|
||||
group by event_name, data_key
|
||||
order by 1, 3 desc
|
||||
limit 500
|
||||
`,
|
||||
params,
|
||||
).then(result => {
|
||||
return Object.values(result).map((a: any) => {
|
||||
return {
|
||||
eventName: a.eventName,
|
||||
propertyName: a.propertyName,
|
||||
dataType: Number(a.dataType),
|
||||
propertyValue: a.propertyValue,
|
||||
total: Number(a.total),
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue