This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$id": "http://example.com/root.json", | |
"$schema": "http://json-schema.org/draft-07/schema#", | |
"definitions": {}, | |
"properties": { | |
"ContentData": { | |
"$id": "#/properties/ContentData", | |
"default": "", | |
"examples": [ | |
"22" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
assoc.master_id, | |
e.event_name, | |
e.event_ts | |
FROM assoc_table assoc | |
INNER JOIN events e ON assoc.id = e.profile_id | |
WHERE | |
( | |
(e.ts >= assoc.condition_ts_value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Profile(): | |
... | |
def add_event(self, event): | |
self._events.append({'event': event, 'ts': datetime.now()}) | |
def add_assoc(self, profile): | |
self._assocs.append({'profile': profile, 'ts': datetime.now()}) | |
def events_after_ts(self, timestamp): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("Post Assoc Profile 1: ", profile_1.events) | |
print("Post Assoc Profile 2: ", profile_2.events) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
profile_1 = Profile(1) | |
profile_2 = Profile(2) | |
id_to_profile = { | |
1: profile_1, | |
2: profile_2 | |
} | |
add_event_to_profile(1, id_to_profile, "1") | |
add_event_to_profile(2, id_to_profile, "2") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Profile(): | |
def __init__(self, id): | |
... | |
self._assocs = [] | |
... | |
def add_assoc(self, profile): | |
self._assocs.append(profile) | |
@property |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for event in profile_2.events: | |
profile_1.add_event(event) | |
profile_2._events = [] | |
new_id_to_profile = { | |
1: profile_1, | |
2: profile_1 | |
} | |
add_event_to_profile(1, new_id_to_profile, "6") | |
add_event_to_profile(1, new_id_to_profile, "7") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_event_to_profile(1, new_id_to_profile, "6") | |
add_event_to_profile(1, new_id_to_profile, "7") | |
add_event_to_profile(2, new_id_to_profile, "8") | |
add_event_to_profile(2, new_id_to_profile, "9") | |
add_event_to_profile(1, new_id_to_profile, "10") | |
print("profile_1 after forward merge:", profile_1.events) | |
print("profile_2 after forward merge:", profile_2.events) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new_id_to_profile = { | |
1: profile_1, | |
2: profile_1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Profile(): | |
def __init__(self, id): | |
self._id = id | |
self._events = [] | |
def add_event(self, event): | |
self._events.append(event) | |
@property | |
def events(self): |