Updated data query limits.

This commit is contained in:
Mike Cao 2024-08-17 20:27:40 -07:00
parent b6b1488ddf
commit ffa954ee02
4 changed files with 13 additions and 5 deletions

View File

@ -189,7 +189,7 @@ async function rawQuery<T = unknown>(
format: 'JSONEachRow',
});
return resultSet.json() as T;
return (await resultSet.json()) as T;
}
async function insert(table: string, values: any[]) {

View File

@ -1,3 +1,4 @@
import debug from 'debug';
import { Prisma } from '@prisma/client';
import prisma from '@umami/prisma-client';
import moment from 'moment-timezone';
@ -8,6 +9,8 @@ import { maxDate } from './date';
import { QueryFilters, QueryOptions, PageParams } from './types';
import { filtersToArray } from './params';
const log = debug('umami:prisma');
const MYSQL_DATE_FORMATS = {
minute: '%Y-%m-%d %H:%i:00',
hour: '%Y-%m-%d %H:00:00',
@ -210,6 +213,11 @@ async function parseFilters(
}
async function rawQuery(sql: string, data: object): Promise<any> {
if (process.env.LOG_QUERY) {
log('QUERY:\n', sql);
log('PARAMETERS:\n', data);
}
const db = getDatabaseType();
const params = [];

View File

@ -35,7 +35,7 @@ async function relationalQuery(
${filterQuery}
group by string_value
order by 2 desc
limit 500
limit 100
`,
params,
);
@ -63,7 +63,7 @@ async function clickhouseQuery(
${filterQuery}
group by event_name, value
order by 2 desc
limit 500;
limit 100
`,
params,
).then(result => {

View File

@ -31,7 +31,7 @@ async function relationalQuery(
${filterQuery}
group by string_value
order by 2 desc
limit 500
limit 100
`,
params,
);
@ -58,7 +58,7 @@ async function clickhouseQuery(
${filterQuery}
group by value
order by 2 desc
limit 500;
limit 100
`,
params,
).then(result => {