Skip to content

Commit

Permalink
Figure out psycopg problem and try Django 4.2 again
Browse files Browse the repository at this point in the history
  • Loading branch information
webjunkie committed Nov 16, 2023
1 parent faad0ca commit c474c03
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions posthog/models/feature_flag/flag_matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,8 @@ def get_all_feature_flags(
distinct_ids = [distinct_id, str(hash_key_override)]
query = """
WITH target_person_ids AS (
SELECT team_id, person_id FROM posthog_persondistinctid WHERE team_id = %(team_id)s AND distinct_id IN %(distinct_ids)s
SELECT team_id, person_id FROM posthog_persondistinctid WHERE team_id = %(team_id)s AND
distinct_id = ANY(%(distinct_ids)s)
),
existing_overrides AS (
SELECT team_id, person_id, feature_flag_key, hash_key FROM posthog_featureflaghashkeyoverride
Expand All @@ -723,7 +724,7 @@ def get_all_feature_flags(
"""
cursor.execute(
query,
{"team_id": team_id, "distinct_ids": tuple(distinct_ids)}, # type: ignore
{"team_id": team_id, "distinct_ids": distinct_ids}, # type: ignore
)
flags_with_no_overrides = [row[0] for row in cursor.fetchall()]
should_write_hash_key_override = len(flags_with_no_overrides) > 0
Expand Down Expand Up @@ -824,7 +825,8 @@ def set_feature_flag_hash_key_overrides(team_id: int, distinct_ids: List[str], h
with execute_with_timeout(FLAG_MATCHING_QUERY_TIMEOUT_MS) as cursor:
query = """
WITH target_person_ids AS (
SELECT team_id, person_id FROM posthog_persondistinctid WHERE team_id = %(team_id)s AND distinct_id IN %(distinct_ids)s
SELECT team_id, person_id FROM posthog_persondistinctid WHERE team_id = %(team_id)s AND
distinct_id = ANY(%(distinct_ids)s)
),
existing_overrides AS (
SELECT team_id, person_id, feature_flag_key, hash_key FROM posthog_featureflaghashkeyoverride
Expand Down Expand Up @@ -853,7 +855,7 @@ def set_feature_flag_hash_key_overrides(team_id: int, distinct_ids: List[str], h
query,
{
"team_id": team_id,
"distinct_ids": tuple(distinct_ids), # type: ignore
"distinct_ids": distinct_ids, # type: ignore
"hash_key_override": hash_key_override,
},
)
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ coverage[toml]==5.5
# pytest-cov
datamodel-code-generator==0.21.5
# via -r requirements-dev.in
django==4.1.13
django==4.2.1
# via
# -c requirements.txt
# django-stubs
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ clickhouse-pool==0.5.3
cryptography==37.0.2
defusedxml==0.6.0
dj-database-url==0.5.0
Django==4.1.13
Django==4.2.1
django-axes==5.9.0
django-cors-headers==3.5.0
django-deprecate-fields==0.1.1
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ defusedxml==0.6.0
# social-auth-core
dj-database-url==0.5.0
# via -r requirements.in
django==4.1.13
django==4.2.1
# via
# -r requirements.in
# django-axes
Expand Down

0 comments on commit c474c03

Please sign in to comment.