posthog/clickhouse/test/test_person_overrides.py
results = sync_execute(
                """
                SELECT
                    created_at,
                    team_id,
                    old_person_id,
                    override_person_id,
                    oldest_event,
                    merged_at,
                    version
                FROM
                    person_overrides
                WHERE old_person_id = %(old_person_id)s
                """,
                {"old_person_id": str(old_person_id)},
            )
            if results:
                break
            sleep(1)
        assert isinstance(results, list)
        assert results != []
        [result] = results
        created_at, *the_rest = result
        assert the_rest == [1, old_person_id, override_person_id, oldest_event, merged_at, 2]
        assert created_at > datetime.now(tz=pytz.UTC) - timedelta(seconds=10)
    finally:
        producer.close()
        sync_execute(DROP_KAFKA_PERSON_OVERRIDES_TABLE_SQL)
        sync_execute(DROP_PERSON_OVERRIDES_CREATE_MATERIALIZED_VIEW_SQL)