mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
clickhouse inserts
This commit is contained in:
parent
6ea2282f82
commit
65910c7348
13 changed files with 146 additions and 40 deletions
17
lib/db.js
17
lib/db.js
|
|
@ -72,19 +72,6 @@ function initializeClickhouse() {
|
|||
database,
|
||||
},
|
||||
});
|
||||
|
||||
// return new ClickHouse({
|
||||
// url: 'http://164.92.95.2',
|
||||
// port: 8123,
|
||||
// basicAuth: {
|
||||
// username: 'default',
|
||||
// password: 'shhhthisissupersecret!',
|
||||
// },
|
||||
// format: 'json',
|
||||
// config: {
|
||||
// database: 'umami_dev',
|
||||
// },
|
||||
// });
|
||||
}
|
||||
|
||||
const prisma = initializePrisma(options);
|
||||
|
|
@ -243,7 +230,7 @@ export function getFilterQuery(table, filters = {}, params = []) {
|
|||
return query.join('\n');
|
||||
}
|
||||
|
||||
export function parseFilters(table, filters = {}, params = []) {
|
||||
export function parseFilters(table, filters = {}, params = [], sessionKey = 'session_id') {
|
||||
const { domain, url, event_url, referrer, os, browser, device, country, event_type } = filters;
|
||||
|
||||
const pageviewFilters = { domain, url, referrer };
|
||||
|
|
@ -257,7 +244,7 @@ export function parseFilters(table, filters = {}, params = []) {
|
|||
event: { event_type },
|
||||
joinSession:
|
||||
os || browser || device || country
|
||||
? `inner join session on ${table}.session_id = session.session_id`
|
||||
? `inner join session on ${table}.${sessionKey} = session.${sessionKey}`
|
||||
: '',
|
||||
pageviewQuery: getFilterQuery('pageview', pageviewFilters, params),
|
||||
sessionQuery: getFilterQuery('session', sessionFilters, params),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue