web: log sql queries
This commit is contained in:
@@ -7,6 +7,12 @@ import {
|
|||||||
selectJsonPath,
|
selectJsonPath,
|
||||||
} from './helpers';
|
} from './helpers';
|
||||||
|
|
||||||
|
function log(sql: string) {
|
||||||
|
const logs = ['--- START', sql, '--- END'];
|
||||||
|
console.log(logs.join('\n'));
|
||||||
|
return sql;
|
||||||
|
}
|
||||||
|
|
||||||
export function getChartSql({
|
export function getChartSql({
|
||||||
event,
|
event,
|
||||||
breakdowns,
|
breakdowns,
|
||||||
@@ -64,8 +70,10 @@ export function getChartSql({
|
|||||||
ORDER BY profile_id, "createdAt" DESC
|
ORDER BY profile_id, "createdAt" DESC
|
||||||
) as subQuery`;
|
) as subQuery`;
|
||||||
|
|
||||||
return `${getSelect()} ${getFrom()} ${getGroupBy()} ${getOrderBy()}`;
|
return log(`${getSelect()} ${getFrom()} ${getGroupBy()} ${getOrderBy()}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${getSelect()} ${getFrom()} ${getWhere()} ${getGroupBy()} ${getOrderBy()}`;
|
return log(
|
||||||
|
`${getSelect()} ${getFrom()} ${getWhere()} ${getGroupBy()} ${getOrderBy()}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user