Skip to content
Merged
Changes from all commits
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
5 changes: 3 additions & 2 deletions posthog/management/commands/fix_cohort_people_unsynced_ch.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,13 @@ def handle(self, *args, **options):
cohort_to_uuids[cohort_id].append(uuid)

batch_inserted = 0
team_id = clickhouse_batch[0][2] # Get team_id from first record

for cohort_id, person_uuids in cohort_to_uuids.items():
try:
cohort = Cohort.objects.get(id=cohort_id)
cohort.insert_users_list_by_uuid_into_pg_only(items=person_uuids, team_id=team_id)
cohort.insert_users_list_by_uuid_into_pg_only(
items=person_uuids, team_id=cohort.team_id
)
batch_inserted += len(person_uuids)
except Exception as e:
self.stdout.write(self.style.ERROR(f"Error inserting into cohort {cohort_id}: {e}"))
Expand Down
Loading