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

Funnels reorganization, persons pagination, and conversion window support #4810

Merged
merged 15 commits into from
Jun 24, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
helper function to insert data for local testing
  • Loading branch information
buwilliams committed Jun 20, 2021

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit e9523088b5f369c5782e33ef29d6bcc0cb707eb9
23 changes: 23 additions & 0 deletions ee/clickhouse/demo.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import uuid
from typing import Dict, List
from uuid import uuid4

from ee.clickhouse.models.event import create_event
from ee.clickhouse.models.session_recording_event import create_session_recording_event
from posthog.models import EventDefinition, Person, Team


def bulk_create_events(events: List[Dict], **kw):
@@ -13,3 +15,24 @@ def bulk_create_events(events: List[Dict], **kw):
def bulk_create_session_recording_events(events: List[Dict], **kw):
for data in events:
create_session_recording_event(**data, **kw, uuid=uuid4()) # type: ignore


def insert_localdev_data(team_id=1, number=250):
team = Team.objects.get(id=team_id)

EventDefinition.objects.get_or_create(team=team, name="step one")
EventDefinition.objects.get_or_create(team=team, name="step two")
EventDefinition.objects.get_or_create(team=team, name="step three")
EventDefinition.objects.get_or_create(team=team, name="step four")
EventDefinition.objects.get_or_create(team=team, name="step five")

for i in range(number):
try:
Person.objects.create(distinct_ids=[f"user_{i}"], team=team)
except Exception as e:
print(str(e))
create_event(uuid.uuid4(), "step one", team, f"user_{i}", "2021-05-01 00:00:00")
create_event(uuid.uuid4(), "step two", team, f"user_{i}", "2021-05-03 00:00:00")
create_event(uuid.uuid4(), "step three", team, f"user_{i}", "2021-05-05 00:00:00")
create_event(uuid.uuid4(), "step four", team, f"user_{i}", "2021-05-07 00:00:00")
create_event(uuid.uuid4(), "step five", team, f"user_{i}", "2021-05-09 00:00:00")