-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat(person-on-events): Enable CI to run using both old and new queries #9814
Changes from all commits
33a6235
a7aeef4
6b4a263
a209368
79a06a3
f17b33b
6155027
a38c21c
1bfbf41
fe6b5cd
c0b9375
110b832
a6da68f
89accdf
37a1a9c
72db871
4a76432
d4af83f
e44e4d3
aa6a840
b3153d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ def create_event( | |
return str(event_uuid) | ||
|
||
|
||
def bulk_create_events(events: List[Dict[str, Any]]): | ||
def bulk_create_events(events: List[Dict[str, Any]], person_mapping: Optional[Dict[str, Person]] = None) -> None: | ||
""" | ||
TEST ONLY | ||
Insert events in bulk. List of dicts: | ||
|
@@ -88,10 +88,22 @@ def bulk_create_events(events: List[Dict[str, Any]]): | |
elements_chain = elements_to_string(elements=event.get("elements")) # type: ignore | ||
|
||
inserts.append( | ||
"(%(uuid_{i})s, %(event_{i})s, %(properties_{i})s, %(timestamp_{i})s, %(team_id_{i})s, %(distinct_id_{i})s, %(elements_chain_{i})s, %(created_at_{i})s, now(), 0)".format( | ||
"(%(uuid_{i})s, %(event_{i})s, %(properties_{i})s, %(timestamp_{i})s, %(team_id_{i})s, %(distinct_id_{i})s, %(elements_chain_{i})s, %(person_id_{i})s, %(person_properties_{i})s, %(group0_properties_{i})s, %(group1_properties_{i})s, %(group2_properties_{i})s, %(group3_properties_{i})s, %(group4_properties_{i})s, %(created_at_{i})s, now(), 0)".format( | ||
i=index | ||
) | ||
) | ||
|
||
# use person properties mapping to populate person properties in given event | ||
if person_mapping and person_mapping.get(event["distinct_id"]): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Going to need to handle group properties in some way like this too There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aye, leaving it for a PR where groups get tackled, as that provides an easy way to test the changes are sound. Right now, since there's no code actually using the instance setting, the new CI stuff still runs the old code, with extra event properties populated. |
||
person_properties = person_mapping[event["distinct_id"]].properties | ||
person_id = person_mapping[event["distinct_id"]].uuid | ||
|
||
event = { | ||
**event, | ||
"person_properties": {**person_properties, **event.get("person_properties", {})}, | ||
"person_id": person_id, | ||
} | ||
|
||
event = { | ||
"uuid": str(event["event_uuid"]) if event.get("event_uuid") else str(uuid.uuid4()), | ||
"event": event["event"], | ||
|
@@ -101,6 +113,13 @@ def bulk_create_events(events: List[Dict[str, Any]]): | |
"distinct_id": str(event["distinct_id"]), | ||
"elements_chain": elements_chain, | ||
"created_at": timestamp, | ||
"person_id": event["person_id"] if event.get("person_id") else "00000000-0000-0000-0000-000000000000", | ||
"person_properties": json.dumps(event["person_properties"]) if event.get("person_properties") else "{}", | ||
"group0_properties": json.dumps(event["group0_properties"]) if event.get("group0_properties") else "{}", | ||
"group1_properties": json.dumps(event["group1_properties"]) if event.get("group1_properties") else "{}", | ||
"group2_properties": json.dumps(event["group2_properties"]) if event.get("group2_properties") else "{}", | ||
"group3_properties": json.dumps(event["group3_properties"]) if event.get("group3_properties") else "{}", | ||
"group4_properties": json.dumps(event["group4_properties"]) if event.get("group4_properties") else "{}", | ||
} | ||
|
||
params = {**params, **{"{}_{}".format(key, index): value for key, value in event.items()}} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's supposed to be happening here? Not sure how this is preventing snapshotsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, these updates aren't committed so it never has any impact
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep exactly