-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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(persons-on-events): Support backfilling multiple teams, and store backfill state #20886
Conversation
updated_teams = list( | ||
Team.objects.raw( | ||
""" | ||
UPDATE posthog_team | ||
SET extra_settings = COALESCE(extra_settings, '{}'::jsonb) || jsonb_build_object('distinct_id_overrides_backfilled', true) | ||
WHERE id = %s | ||
RETURNING * | ||
""", | ||
[self.team_id], | ||
) | ||
) |
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.
I had assumed there would be a more convenient way to update this via the ORM… not sure the "shortcut" was worth it at this point.
@@ -14,10 +15,12 @@ | |||
|
|||
|
|||
@dataclass | |||
class BackfillQuery: |
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.
This is a bit more than a Query
at this point.
Problem
The backfill command previously wasn't convenient to use to run a mass backfill over all teams, e.g. as a Kubernetes
Job
, or even just manually run from a toolbox pod.This allows it to be executed over all teams that have not already been marked as backfilled unless a specific
--team-id
is provided. Tracking the state makes lets us make sure that no teams were missed, as well as prevents duplicate rows being unnecessarily inserted in case of repeat executions.How did you test this code?
The more important
Backfill
was already tested, manually tested the CLI variations.--team-id
--team-id
(including invalid team)