fix CH return.

This commit is contained in:
Brian Cao 2022-07-25 09:47:11 -07:00
parent af7c6f73b0
commit f189035a73
16 changed files with 40 additions and 34 deletions

View file

@ -277,14 +277,22 @@ export async function rawQueryClickhouse(query, params = [], debug = false) {
return clickhouse.query(formattedQuery).toPromise();
}
export async function findUnique(data) {
if (data.length > 1) {
throw `${data.length} records found when expecting 1.`;
}
return data[0] ?? null;
}
export async function runAnalyticsQuery(queries) {
const db = getAnalyticsDatabase();
if (db === POSTGRESQL || db === MYSQL) {
return queries[`${RELATIONAL}`]();
return queries[RELATIONAL]();
}
if (db === CLICKHOUSE) {
return queries[`${CLICKHOUSE}`]();
return queries[CLICKHOUSE]();
}
}