Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brian/uc 35 merge tables ch #1515

Merged
merged 5 commits into from
Sep 13, 2022
Merged

Brian/uc 35 merge tables ch #1515

merged 5 commits into from
Sep 13, 2022

Conversation

briancao
Copy link
Collaborator

Merge session/pageview/event for CH database.

@vercel
Copy link

vercel bot commented Sep 12, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
umami ✅ Ready (Inspect) Visit Preview Sep 13, 2022 at 4:20PM (UTC)

@netlify
Copy link

netlify bot commented Sep 12, 2022

Deploy Preview for heartfelt-souffle-72e1df failed.

Name Link
🔨 Latest commit dd54fb3
🔍 Latest deploy log https://app.netlify.com/sites/heartfelt-souffle-72e1df/deploys/6320ad773d42420008c8697c

Copy link
Collaborator

@mikecao mikecao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple quetsions.

arr.push(`and ${table}.${key}=$${params.length + 1}`);
params.push(decodeURIComponent(filter));
}
arr.push(`and ${key}=$${params.length + 1}`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is all same logic as above, they should be combined.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged logic.

lib/session.js Outdated
@@ -31,11 +34,11 @@ export async function getSession(req) {
let websiteId = null;

// Check if website exists
if (redis.client) {
if (isRedis) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes less sense. If "we have a redis client" vs "we are a redis?"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated language.

created_at: getDateFormat(new Date()),
url: url?.substring(0, URL_LENGTH),
event_name: event_name?.substring(0, EVENT_NAME_LENGTH),
event_data: JSON.stringify(event_data),
...sessionArgs,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are sessionArgs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we pass the entire session object now, where sessionArgs is the rest of the session data ( hostname, browser, os, device, language). Country is the only property that needs special care.

${column !== 'event_name' ? `and event_name = ''` : ''}
and ${getBetweenDates('created_at', startDate, endDate)}
${pageviewQuery}
${sessionQuery}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work without knowing you need to join session?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

joinSession only needs to occur if data is collected outside of the primary table being collected on. Now that everything is merged into 1 table, a join never needs to occur.

@mikecao mikecao merged commit b12bfb2 into dev Sep 13, 2022
@mikecao mikecao deleted the brian/uc-35-merge-tables-ch branch September 13, 2022 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants