add getEventDataFields

This commit is contained in:
Francis Cao 2024-09-13 08:31:52 -07:00
parent 29044de736
commit e440779c7a
4 changed files with 123 additions and 2 deletions

View file

@ -49,7 +49,7 @@ async function relationalQuery(
async function clickhouseQuery(
websiteId: string,
filters: QueryFilters & { eventName?: string; propertyName?: string },
): Promise<{ propertyName: string; dataType: number; propertyValue: string; total: number }[]> {
): Promise<{ value: string; total: number }[]> {
const { rawQuery, parseFilters } = clickhouse;
const { filterQuery, params } = await parseFilters(websiteId, filters);
@ -66,7 +66,7 @@ async function clickhouseQuery(
and data_key = {propertyName:String}
and event_name = {eventName:String}
${filterQuery}
group by event_name, value
group by value
order by 2 desc
limit 100
`,