Skip to content

Instantly share code, notes, and snippets.

View linkerzx's full-sized avatar

Julien Kervizic linkerzx

  • Facebook
  • London
View GitHub Profile
{
"$id": "http://example.com/root.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {},
"properties": {
"ContentData": {
"$id": "#/properties/ContentData",
"default": "",
"examples": [
"22"
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)
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):
print("Post Assoc Profile 1: ", profile_1.events)
print("Post Assoc Profile 2: ", profile_2.events)
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")
class Profile():
def __init__(self, id):
...
self._assocs = []
...
def add_assoc(self, profile):
self._assocs.append(profile)
@property
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")
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)
new_id_to_profile = {
1: profile_1,
2: profile_1
}
class Profile():
def __init__(self, id):
self._id = id
self._events = []
def add_event(self, event):
self._events.append(event)
@property
def events(self):