From 907c0eba0a3267fcd109078ade743e29e4a61c79 Mon Sep 17 00:00:00 2001 From: danielxnj <115043334+danielxnj@users.noreply.github.com> Date: Thu, 14 Dec 2023 12:46:39 -0500 Subject: [PATCH] Revert "chore(deps): Upgrade to Django 4.1 (#19285)" This reverts commit 3c399da5d22e80378925291d8a679703cda14cdc. --- .../test_organization_resource_access.ambr | 4 +- .../api/test/__snapshots__/test_decide.ambr | 2 +- .../test/__snapshots__/test_feature_flag.ambr | 181 ++++++++++++++---- .../test_organization_feature_flag.ambr | 6 +- .../api/test/__snapshots__/test_plugin.ambr | 8 +- .../__snapshots__/test_dashboard.ambr | 9 - posthog/api/test/test_organization.py | 2 +- posthog/api/test/test_team.py | 2 +- posthog/middleware.py | 2 +- .../test/__snapshots__/test_filter.ambr | 4 +- posthog/models/test/test_tagged_item_model.py | 11 +- posthog/settings/access.py | 1 - .../temporal/batch_exports/batch_exports.py | 8 +- .../data_imports/external_data_job.py | 16 +- posthog/temporal/tests/conftest.py | 8 +- .../temporal/tests/test_external_data_job.py | 44 ++--- posthog/temporal/tests/utils/models.py | 8 +- .../test/__snapshots__/test_feature_flag.ambr | 40 ++-- requirements-dev.in | 2 +- requirements-dev.txt | 12 +- requirements.in | 2 +- requirements.txt | 6 +- 22 files changed, 243 insertions(+), 135 deletions(-) diff --git a/ee/api/test/__snapshots__/test_organization_resource_access.ambr b/ee/api/test/__snapshots__/test_organization_resource_access.ambr index ecbd2e7c73618..98e6953f9694f 100644 --- a/ee/api/test/__snapshots__/test_organization_resource_access.ambr +++ b/ee/api/test/__snapshots__/test_organization_resource_access.ambr @@ -78,7 +78,7 @@ --- # name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.11 ' - SELECT 1 AS "a" + SELECT (1) AS "a" FROM "posthog_organizationmembership" WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid AND "posthog_organizationmembership"."user_id" = 2) @@ -160,7 +160,7 @@ --- # name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.3 ' - SELECT 1 AS "a" + SELECT (1) AS "a" FROM "posthog_organizationmembership" WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid AND "posthog_organizationmembership"."user_id" = 2) diff --git a/posthog/api/test/__snapshots__/test_decide.ambr b/posthog/api/test/__snapshots__/test_decide.ambr index 414c27001f947..79f2ae80438a2 100644 --- a/posthog/api/test/__snapshots__/test_decide.ambr +++ b/posthog/api/test/__snapshots__/test_decide.ambr @@ -137,7 +137,7 @@ --- # name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.3 ' - SELECT 1 AS "a" + SELECT (1) AS "a" FROM "posthog_grouptypemapping" WHERE "posthog_grouptypemapping"."team_id" = 2 LIMIT 1 /*controller='team-detail',route='api/projects/%28%3FP%3Cid%3E%5B%5E/.%5D%2B%29/%3F%24'*/ diff --git a/posthog/api/test/__snapshots__/test_feature_flag.ambr b/posthog/api/test/__snapshots__/test_feature_flag.ambr index c4ef47873e5f8..8aa343d472877 100644 --- a/posthog/api/test/__snapshots__/test_feature_flag.ambr +++ b/posthog/api/test/__snapshots__/test_feature_flag.ambr @@ -413,7 +413,7 @@ WHERE ("posthog_persondistinctid"."id" IN (SELECT U0."id" FROM "posthog_persondistinctid" U0 - WHERE U0."person_id" = ("posthog_persondistinctid"."person_id") + WHERE U0."person_id" = "posthog_persondistinctid"."person_id" LIMIT 3) AND "posthog_persondistinctid"."person_id" IN (1, 2, @@ -430,10 +430,10 @@ AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid, '00000000-0000-0000-0000-000000000001'::uuid /* ... */) AND NOT (EXISTS - (SELECT 1 AS "a" + (SELECT (1) AS "a" FROM "posthog_cohortpeople" U1 WHERE (U1."cohort_id" = 2 - AND U1."person_id" = ("posthog_person"."id")) + AND U1."person_id" = "posthog_person"."id") LIMIT 1))) ' --- @@ -528,7 +528,7 @@ WHERE ("posthog_persondistinctid"."id" IN (SELECT U0."id" FROM "posthog_persondistinctid" U0 - WHERE U0."person_id" = ("posthog_persondistinctid"."person_id") + WHERE U0."person_id" = "posthog_persondistinctid"."person_id" LIMIT 3) AND "posthog_persondistinctid"."person_id" IN (1, 2, @@ -567,10 +567,10 @@ AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid, '00000000-0000-0000-0000-000000000001'::uuid /* ... */) AND NOT (EXISTS - (SELECT 1 AS "a" + (SELECT (1) AS "a" FROM "posthog_cohortpeople" U1 WHERE (U1."cohort_id" = 2 - AND U1."person_id" = ("posthog_person"."id")) + AND U1."person_id" = "posthog_person"."id") LIMIT 1))) ' --- @@ -629,10 +629,10 @@ AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid, '00000000-0000-0000-0000-000000000001'::uuid /* ... */) AND NOT (EXISTS - (SELECT 1 AS "a" + (SELECT (1) AS "a" FROM "posthog_cohortpeople" U1 WHERE (U1."cohort_id" = 2 - AND U1."person_id" = ("posthog_person"."id")) + AND U1."person_id" = "posthog_person"."id") LIMIT 1))) ' --- @@ -741,11 +741,11 @@ AND "posthog_person"."properties" ? 'group2' AND NOT (("posthog_person"."properties" -> 'group2') = 'null')) OR EXISTS - (SELECT 1 AS "a" + (SELECT (1) AS "a" FROM "posthog_cohortpeople" U0 WHERE (U0."cohort_id" = 2 AND U0."cohort_id" = 2 - AND U0."person_id" = ("posthog_person"."id")) + AND U0."person_id" = "posthog_person"."id") LIMIT 1) OR (("posthog_person"."properties" -> 'does-not-exist') = '"none"' AND "posthog_person"."properties" ? 'does-not-exist' @@ -768,7 +768,7 @@ WHERE ("posthog_persondistinctid"."id" IN (SELECT U0."id" FROM "posthog_persondistinctid" U0 - WHERE U0."person_id" = ("posthog_persondistinctid"."person_id") + WHERE U0."person_id" = "posthog_persondistinctid"."person_id" LIMIT 3) AND "posthog_persondistinctid"."person_id" IN (1, 2, @@ -782,11 +782,11 @@ SELECT ("posthog_person"."id" IS NULL OR "posthog_person"."id" IS NULL OR EXISTS - (SELECT 1 AS "a" + (SELECT (1) AS "a" FROM "posthog_cohortpeople" U0 WHERE (U0."cohort_id" = 2 AND U0."cohort_id" = 2 - AND U0."person_id" = ("posthog_person"."id")) + AND U0."person_id" = "posthog_person"."id") LIMIT 1) OR "posthog_person"."id" IS NULL) AS "flag_X_condition_0" FROM "posthog_person" @@ -801,11 +801,11 @@ SELECT ("posthog_person"."id" IS NOT NULL OR "posthog_person"."id" IS NULL OR EXISTS - (SELECT 1 AS "a" + (SELECT (1) AS "a" FROM "posthog_cohortpeople" U0 WHERE (U0."cohort_id" = 2 AND U0."cohort_id" = 2 - AND U0."person_id" = ("posthog_person"."id")) + AND U0."person_id" = "posthog_person"."id") LIMIT 1) OR "posthog_person"."id" IS NULL) AS "flag_X_condition_0" FROM "posthog_person" @@ -820,11 +820,11 @@ SELECT ("posthog_person"."id" IS NULL OR "posthog_person"."id" IS NOT NULL OR EXISTS - (SELECT 1 AS "a" + (SELECT (1) AS "a" FROM "posthog_cohortpeople" U0 WHERE (U0."cohort_id" = 2 AND U0."cohort_id" = 2 - AND U0."person_id" = ("posthog_person"."id")) + AND U0."person_id" = "posthog_person"."id") LIMIT 1) OR "posthog_person"."id" IS NULL) AS "flag_X_condition_0" FROM "posthog_person" @@ -839,11 +839,11 @@ SELECT ("posthog_person"."id" IS NULL OR "posthog_person"."id" IS NULL OR EXISTS - (SELECT 1 AS "a" + (SELECT (1) AS "a" FROM "posthog_cohortpeople" U0 WHERE (U0."cohort_id" = 2 AND U0."cohort_id" = 2 - AND U0."person_id" = ("posthog_person"."id")) + AND U0."person_id" = "posthog_person"."id") LIMIT 1) OR "posthog_person"."id" IS NULL) AS "flag_X_condition_0" FROM "posthog_person" @@ -876,11 +876,11 @@ AND "posthog_person"."properties" ? 'group2' AND NOT (("posthog_person"."properties" -> 'group2') = 'null')) OR EXISTS - (SELECT 1 AS "a" + (SELECT (1) AS "a" FROM "posthog_cohortpeople" U0 WHERE (U0."cohort_id" = 2 AND U0."cohort_id" = 2 - AND U0."person_id" = ("posthog_person"."id")) + AND U0."person_id" = "posthog_person"."id") LIMIT 1) OR (("posthog_person"."properties" -> 'does-not-exist') = '"none"' AND "posthog_person"."properties" ? 'does-not-exist' @@ -951,7 +951,7 @@ WHERE ("posthog_persondistinctid"."id" IN (SELECT U0."id" FROM "posthog_persondistinctid" U0 - WHERE U0."person_id" = ("posthog_persondistinctid"."person_id") + WHERE U0."person_id" = "posthog_persondistinctid"."person_id" LIMIT 3) AND "posthog_persondistinctid"."person_id" IN (1, 2, @@ -988,10 +988,10 @@ AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid, '00000000-0000-0000-0000-000000000001'::uuid /* ... */) AND NOT (EXISTS - (SELECT 1 AS "a" + (SELECT (1) AS "a" FROM "posthog_cohortpeople" U1 WHERE (U1."cohort_id" = 2 - AND U1."person_id" = ("posthog_person"."id")) + AND U1."person_id" = "posthog_person"."id") LIMIT 1))) ' --- @@ -1085,7 +1085,7 @@ WHERE ("posthog_persondistinctid"."id" IN (SELECT U0."id" FROM "posthog_persondistinctid" U0 - WHERE U0."person_id" = ("posthog_persondistinctid"."person_id") + WHERE U0."person_id" = "posthog_persondistinctid"."person_id" LIMIT 3) AND "posthog_persondistinctid"."person_id" IN (1, 2, @@ -1124,10 +1124,10 @@ AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid, '00000000-0000-0000-0000-000000000001'::uuid /* ... */) AND NOT (EXISTS - (SELECT 1 AS "a" + (SELECT (1) AS "a" FROM "posthog_cohortpeople" U1 WHERE (U1."cohort_id" = 2 - AND U1."person_id" = ("posthog_person"."id")) + AND U1."person_id" = "posthog_person"."id") LIMIT 1))) ' --- @@ -1334,7 +1334,7 @@ WHERE ("posthog_persondistinctid"."id" IN (SELECT U0."id" FROM "posthog_persondistinctid" U0 - WHERE U0."person_id" = ("posthog_persondistinctid"."person_id") + WHERE U0."person_id" = "posthog_persondistinctid"."person_id" LIMIT 3) AND "posthog_persondistinctid"."person_id" IN (1, 2, @@ -1415,10 +1415,10 @@ AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid, '00000000-0000-0000-0000-000000000001'::uuid /* ... */) AND NOT (EXISTS - (SELECT 1 AS "a" + (SELECT (1) AS "a" FROM "posthog_cohortpeople" U1 WHERE (U1."cohort_id" = 2 - AND U1."person_id" = ("posthog_person"."id")) + AND U1."person_id" = "posthog_person"."id") LIMIT 1))) ' --- @@ -1572,7 +1572,7 @@ WHERE ("posthog_persondistinctid"."id" IN (SELECT U0."id" FROM "posthog_persondistinctid" U0 - WHERE U0."person_id" = ("posthog_persondistinctid"."person_id") + WHERE U0."person_id" = "posthog_persondistinctid"."person_id" LIMIT 3) AND "posthog_persondistinctid"."person_id" IN (1, 2, @@ -1611,10 +1611,10 @@ AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid, '00000000-0000-0000-0000-000000000001'::uuid /* ... */) AND NOT (EXISTS - (SELECT 1 AS "a" + (SELECT (1) AS "a" FROM "posthog_cohortpeople" U1 WHERE (U1."cohort_id" = 2 - AND U1."person_id" = ("posthog_person"."id")) + AND U1."person_id" = "posthog_person"."id") LIMIT 1))) /*controller='project_feature_flags-create-static-cohort-for-flag',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/feature_flags/%28%3FP%3Cpk%3E%5B%5E/.%5D%2B%29/create_static_cohort_for_flag/%3F%24'*/ ' --- @@ -1705,6 +1705,64 @@ LIMIT 100 SETTINGS optimize_aggregation_in_order = 1 ' --- +# name: TestFeatureFlag.test_creating_static_cohort.16 + ' + /* user_id:0 request:_snapshot_ */ + SELECT id + FROM person + INNER JOIN + (SELECT person_id + FROM person_static_cohort + WHERE team_id = 2 + AND cohort_id = 2 + GROUP BY person_id, + cohort_id, + team_id) cohort_persons ON cohort_persons.person_id = person.id + WHERE team_id = 2 + GROUP BY id + HAVING max(is_deleted) = 0 + ORDER BY argMax(person.created_at, version) DESC, id DESC + LIMIT 100 SETTINGS optimize_aggregation_in_order = 1 + ' +--- +# name: TestFeatureFlag.test_creating_static_cohort.17 + ' + SELECT "posthog_persondistinctid"."person_id", + "posthog_persondistinctid"."distinct_id" + FROM "posthog_persondistinctid" + WHERE ("posthog_persondistinctid"."distinct_id" IN ('person3') + AND "posthog_persondistinctid"."team_id" = 2) /*controller='project_feature_flags-create-static-cohort-for-flag',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/feature_flags/%28%3FP%3Cpk%3E%5B%5E/.%5D%2B%29/create_static_cohort_for_flag/%3F%24'*/ + ' +--- +# name: TestFeatureFlag.test_creating_static_cohort.18 + ' + SELECT "posthog_featureflaghashkeyoverride"."feature_flag_key", + "posthog_featureflaghashkeyoverride"."hash_key", + "posthog_featureflaghashkeyoverride"."person_id" + FROM "posthog_featureflaghashkeyoverride" + WHERE ("posthog_featureflaghashkeyoverride"."person_id" IN (1, + 2, + 3, + 4, + 5 /* ... */) + AND "posthog_featureflaghashkeyoverride"."team_id" = 2) /*controller='project_feature_flags-create-static-cohort-for-flag',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/feature_flags/%28%3FP%3Cpk%3E%5B%5E/.%5D%2B%29/create_static_cohort_for_flag/%3F%24'*/ + ' +--- +# name: TestFeatureFlag.test_creating_static_cohort.19 + ' + SELECT "posthog_person"."uuid" + FROM "posthog_person" + WHERE ("posthog_person"."team_id" = 2 + AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid, + '00000000-0000-0000-0000-000000000001'::uuid /* ... */) + AND NOT (EXISTS + (SELECT (1) AS "a" + FROM "posthog_cohortpeople" U1 + WHERE (U1."cohort_id" = 2 + AND U1."person_id" = "posthog_person"."id") + LIMIT 1))) /*controller='project_feature_flags-create-static-cohort-for-flag',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/feature_flags/%28%3FP%3Cpk%3E%5B%5E/.%5D%2B%29/create_static_cohort_for_flag/%3F%24'*/ + ' +--- # name: TestFeatureFlag.test_creating_static_cohort.2 ' SELECT "posthog_organizationmembership"."id", @@ -1735,6 +1793,63 @@ WHERE "posthog_organizationmembership"."user_id" = 2 /*controller='project_feature_flags-create-static-cohort-for-flag',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/feature_flags/%28%3FP%3Cpk%3E%5B%5E/.%5D%2B%29/create_static_cohort_for_flag/%3F%24'*/ ' --- +# name: TestFeatureFlag.test_creating_static_cohort.20 + ' + SELECT "posthog_team"."id", + "posthog_team"."uuid", + "posthog_team"."organization_id", + "posthog_team"."api_token", + "posthog_team"."app_urls", + "posthog_team"."name", + "posthog_team"."slack_incoming_webhook", + "posthog_team"."created_at", + "posthog_team"."updated_at", + "posthog_team"."anonymize_ips", + "posthog_team"."completed_snippet_onboarding", + "posthog_team"."has_completed_onboarding_for", + "posthog_team"."ingested_event", + "posthog_team"."autocapture_opt_out", + "posthog_team"."autocapture_exceptions_opt_in", + "posthog_team"."autocapture_exceptions_errors_to_ignore", + "posthog_team"."session_recording_opt_in", + "posthog_team"."session_recording_sample_rate", + "posthog_team"."session_recording_minimum_duration_milliseconds", + "posthog_team"."session_recording_linked_flag", + "posthog_team"."session_recording_network_payload_capture_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."surveys_opt_in", + "posthog_team"."session_recording_version", + "posthog_team"."signup_token", + "posthog_team"."is_demo", + "posthog_team"."access_control", + "posthog_team"."week_start_day", + "posthog_team"."inject_web_apps", + "posthog_team"."test_account_filters", + "posthog_team"."test_account_filters_default_checked", + "posthog_team"."path_cleaning_filters", + "posthog_team"."timezone", + "posthog_team"."data_attributes", + "posthog_team"."person_display_name_properties", + "posthog_team"."live_events_columns", + "posthog_team"."recording_domains", + "posthog_team"."primary_dashboard_id", + "posthog_team"."extra_settings", + "posthog_team"."correlation_config", + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."plugins_opt_in", + "posthog_team"."opt_out_capture", + "posthog_team"."event_names", + "posthog_team"."event_names_with_usage", + "posthog_team"."event_properties", + "posthog_team"."event_properties_with_usage", + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" + FROM "posthog_team" + WHERE "posthog_team"."id" = 2 + LIMIT 21 /*controller='project_feature_flags-create-static-cohort-for-flag',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/feature_flags/%28%3FP%3Cpk%3E%5B%5E/.%5D%2B%29/create_static_cohort_for_flag/%3F%24'*/ + ' +--- # name: TestFeatureFlag.test_creating_static_cohort.3 ' SELECT "posthog_instancesetting"."id", diff --git a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr index 0850be9b0daef..f049fa11b9a0e 100644 --- a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr +++ b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr @@ -347,7 +347,7 @@ --- # name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.2 ' - SELECT 1 AS "a" + SELECT (1) AS "a" FROM "posthog_organizationmembership" WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid AND "posthog_organizationmembership"."user_id" = 2) @@ -1539,7 +1539,7 @@ --- # name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.8 ' - SELECT 1 AS "a" + SELECT (1) AS "a" FROM "posthog_featureflag" WHERE (NOT "posthog_featureflag"."deleted" AND "posthog_featureflag"."key" = 'copied-flag-key' @@ -1626,7 +1626,7 @@ --- # name: TestOrganizationFeatureFlagGet.test_get_feature_flag_success.2 ' - SELECT 1 AS "a" + SELECT (1) AS "a" FROM "posthog_organizationmembership" WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid AND "posthog_organizationmembership"."user_id" = 2) diff --git a/posthog/api/test/__snapshots__/test_plugin.ambr b/posthog/api/test/__snapshots__/test_plugin.ambr index 440d426a1340a..12888a4afdf3b 100644 --- a/posthog/api/test/__snapshots__/test_plugin.ambr +++ b/posthog/api/test/__snapshots__/test_plugin.ambr @@ -201,7 +201,7 @@ --- # name: TestPluginAPI.test_listing_plugins_is_not_nplus1.15 ' - SELECT 1 AS "a" + SELECT (1) AS "a" FROM "posthog_organizationmembership" WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid AND "posthog_organizationmembership"."user_id" = 2) @@ -381,7 +381,7 @@ --- # name: TestPluginAPI.test_listing_plugins_is_not_nplus1.21 ' - SELECT 1 AS "a" + SELECT (1) AS "a" FROM "posthog_organizationmembership" WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid AND "posthog_organizationmembership"."user_id" = 2) @@ -459,7 +459,7 @@ --- # name: TestPluginAPI.test_listing_plugins_is_not_nplus1.3 ' - SELECT 1 AS "a" + SELECT (1) AS "a" FROM "posthog_organizationmembership" WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid AND "posthog_organizationmembership"."user_id" = 2) @@ -570,7 +570,7 @@ --- # name: TestPluginAPI.test_listing_plugins_is_not_nplus1.9 ' - SELECT 1 AS "a" + SELECT (1) AS "a" FROM "posthog_organizationmembership" WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid AND "posthog_organizationmembership"."user_id" = 2) diff --git a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr index 8b53eb4a014ef..f83d0b0b2ec0e 100644 --- a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr +++ b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr @@ -961,9 +961,6 @@ OR "posthog_dashboardtile"."insight_id" IS NULL) AND "posthog_dashboardtile"."dashboard_id" = 2 AND "posthog_dashboardtile"."dashboard_id" = 2 - AND NOT ("posthog_dashboard"."deleted" - AND "posthog_dashboardtile"."deleted" - AND "posthog_dashboardtile"."deleted" IS NOT NULL) AND (NOT "posthog_dashboarditem"."deleted" OR "posthog_dashboardtile"."insight_id" IS NULL)) ORDER BY "posthog_dashboarditem"."order" ASC /*controller='project_dashboards-detail',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%28%3FP%3Cpk%3E%5B%5E/.%5D%2B%29/%3F%24'*/ @@ -7354,9 +7351,6 @@ OR "posthog_dashboardtile"."insight_id" IS NULL) AND "posthog_dashboardtile"."dashboard_id" = 2 AND "posthog_dashboardtile"."dashboard_id" = 2 - AND NOT ("posthog_dashboard"."deleted" - AND "posthog_dashboardtile"."deleted" - AND "posthog_dashboardtile"."deleted" IS NOT NULL) AND (NOT "posthog_dashboarditem"."deleted" OR "posthog_dashboardtile"."insight_id" IS NULL)) ORDER BY "posthog_dashboarditem"."order" ASC /*controller='project_dashboards-detail',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%28%3FP%3Cpk%3E%5B%5E/.%5D%2B%29/%3F%24'*/ @@ -10025,9 +10019,6 @@ OR "posthog_dashboardtile"."insight_id" IS NULL) AND "posthog_dashboardtile"."dashboard_id" = 2 AND "posthog_dashboardtile"."dashboard_id" = 2 - AND NOT ("posthog_dashboard"."deleted" - AND "posthog_dashboardtile"."deleted" - AND "posthog_dashboardtile"."deleted" IS NOT NULL) AND (NOT "posthog_dashboarditem"."deleted" OR "posthog_dashboardtile"."insight_id" IS NULL)) ORDER BY "posthog_dashboarditem"."order" ASC /*controller='project_dashboards-detail',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%28%3FP%3Cpk%3E%5B%5E/.%5D%2B%29/%3F%24'*/ diff --git a/posthog/api/test/test_organization.py b/posthog/api/test/test_organization.py index 285a074e341cc..450264b1d768e 100644 --- a/posthog/api/test/test_organization.py +++ b/posthog/api/test/test_organization.py @@ -154,4 +154,4 @@ async def acreate_organization(name: str) -> Organization: could use either the api, or django admin to create, to get better parity with real world scenarios. """ - return await sync_to_async(create_organization)(name) + return await sync_to_async(create_organization)(name) # type: ignore diff --git a/posthog/api/test/test_team.py b/posthog/api/test/test_team.py index 36efe0ec889c2..6945defe10b3b 100644 --- a/posthog/api/test/test_team.py +++ b/posthog/api/test/test_team.py @@ -736,4 +736,4 @@ async def acreate_team(organization: Organization, name: str = "Test team") -> T could use either the api, or django admin to create, to get better parity with real world scenarios. """ - return await sync_to_async(create_team)(organization, name=name) + return await sync_to_async(create_team)(organization, name=name) # type: ignore diff --git a/posthog/middleware.py b/posthog/middleware.py index 31a9e0e744f22..f6cf39d7176ab 100644 --- a/posthog/middleware.py +++ b/posthog/middleware.py @@ -361,7 +361,7 @@ def __init__(self, get_response): # Some middlewares raise MiddlewareNotUsed if they are not # needed. In this case we want to avoid the default middlewares # being used. - middlewares.append(middleware_class(get_response=get_response)) + middlewares.append(middleware_class(get_response=None)) except MiddlewareNotUsed: pass diff --git a/posthog/models/filters/test/__snapshots__/test_filter.ambr b/posthog/models/filters/test/__snapshots__/test_filter.ambr index b26e6693f0fc3..6f37e28782d08 100644 --- a/posthog/models/filters/test/__snapshots__/test_filter.ambr +++ b/posthog/models/filters/test/__snapshots__/test_filter.ambr @@ -348,7 +348,7 @@ --- # name: TestDjangoPropertiesToQ.test_person_relative_date_parsing_with_invalid_date ' - SELECT 1 AS "a" + SELECT (1) AS "a" FROM "posthog_person" INNER JOIN "posthog_persondistinctid" ON ("posthog_person"."id" = "posthog_persondistinctid"."person_id") WHERE ("posthog_persondistinctid"."distinct_id" = 'example_id' @@ -359,7 +359,7 @@ --- # name: TestDjangoPropertiesToQ.test_person_relative_date_parsing_with_invalid_date.1 ' - SELECT 1 AS "a" + SELECT (1) AS "a" FROM "posthog_person" INNER JOIN "posthog_persondistinctid" ON ("posthog_person"."id" = "posthog_persondistinctid"."person_id") WHERE ("posthog_persondistinctid"."distinct_id" = 'example_id' diff --git a/posthog/models/test/test_tagged_item_model.py b/posthog/models/test/test_tagged_item_model.py index f11ed0f263518..14d54404ee5c3 100644 --- a/posthog/models/test/test_tagged_item_model.py +++ b/posthog/models/test/test_tagged_item_model.py @@ -1,4 +1,5 @@ from django.core.exceptions import ValidationError +from django.db import IntegrityError from posthog.models import Action, Dashboard, DashboardTile, Insight, Tag, TaggedItem from posthog.test.base import BaseTest @@ -27,7 +28,7 @@ def test_uniqueness_constraint_dashboard(self): tag = Tag.objects.create(name="tag", team_id=self.team.id) TaggedItem.objects.create(dashboard_id=dashboard.id, tag_id=tag.id) - with self.assertRaises(ValidationError): + with self.assertRaises(IntegrityError): TaggedItem.objects.create(dashboard_id=dashboard.id, tag_id=tag.id) def test_uniqueness_constraint_insight(self): @@ -37,7 +38,7 @@ def test_uniqueness_constraint_insight(self): tag = Tag.objects.create(name="tag", team_id=self.team.id) TaggedItem.objects.create(insight_id=insight.id, tag_id=tag.id) - with self.assertRaises(ValidationError): + with self.assertRaises(IntegrityError): TaggedItem.objects.create(insight_id=insight.id, tag_id=tag.id) def test_uniqueness_constraint_event_definition(self): @@ -52,7 +53,7 @@ def test_uniqueness_constraint_event_definition(self): tag = Tag.objects.create(name="tag", team_id=self.team.id) TaggedItem.objects.create(event_definition_id=event_definition.id, tag_id=tag.id) - with self.assertRaises(ValidationError): + with self.assertRaises(IntegrityError): TaggedItem.objects.create(event_definition_id=event_definition.id, tag_id=tag.id) def test_uniqueness_constraint_property_definition(self): @@ -67,7 +68,7 @@ def test_uniqueness_constraint_property_definition(self): tag = Tag.objects.create(name="tag", team_id=self.team.id) TaggedItem.objects.create(property_definition_id=property_definition.id, tag_id=tag.id) - with self.assertRaises(ValidationError): + with self.assertRaises(IntegrityError): TaggedItem.objects.create(property_definition_id=property_definition.id, tag_id=tag.id) def test_uniqueness_constraint_action(self): @@ -75,5 +76,5 @@ def test_uniqueness_constraint_action(self): tag = Tag.objects.create(name="tag", team_id=self.team.id) TaggedItem.objects.create(action_id=action.id, tag_id=tag.id) - with self.assertRaises(ValidationError): + with self.assertRaises(IntegrityError): TaggedItem.objects.create(action_id=action.id, tag_id=tag.id) diff --git a/posthog/settings/access.py b/posthog/settings/access.py index 1a339e6a54c39..cb7a0ae26809c 100644 --- a/posthog/settings/access.py +++ b/posthog/settings/access.py @@ -25,7 +25,6 @@ if get_from_env("DISABLE_SECURE_SSL_REDIRECT", False, type_cast=str_to_bool): SECURE_SSL_REDIRECT = False -CSRF_TRUSTED_ORIGINS = [os.getenv("SITE_URL", "http://localhost:8000").rstrip("/")] # Proxy settings IS_BEHIND_PROXY = get_from_env("IS_BEHIND_PROXY", False, type_cast=str_to_bool) diff --git a/posthog/temporal/batch_exports/batch_exports.py b/posthog/temporal/batch_exports/batch_exports.py index 171cd9c90323c..c29ec1a1f6b49 100644 --- a/posthog/temporal/batch_exports/batch_exports.py +++ b/posthog/temporal/batch_exports/batch_exports.py @@ -513,7 +513,7 @@ async def create_export_run(inputs: CreateBatchExportRunInputs) -> str: # 'sync_to_async' type hints are fixed in asgiref>=3.4.1 # But one of our dependencies is pinned to asgiref==3.3.2. # Remove these comments once we upgrade. - run = await sync_to_async(create_batch_export_run)( + run = await sync_to_async(create_batch_export_run)( # type: ignore batch_export_id=uuid.UUID(inputs.batch_export_id), data_interval_start=inputs.data_interval_start, data_interval_end=inputs.data_interval_end, @@ -542,7 +542,7 @@ async def update_export_run_status(inputs: UpdateBatchExportRunStatusInputs): run_id=uuid.UUID(inputs.id), status=inputs.status, latest_error=inputs.latest_error, - ) + ) # type: ignore if batch_export_run.status == "Failed": logger.error("BatchExport failed with error: %s", batch_export_run.latest_error) @@ -583,7 +583,7 @@ async def create_batch_export_backfill_model(inputs: CreateBatchExportBackfillIn # 'sync_to_async' type hints are fixed in asgiref>=3.4.1 # But one of our dependencies is pinned to asgiref==3.3.2. # Remove these comments once we upgrade. - run = await sync_to_async(create_batch_export_backfill)( + run = await sync_to_async(create_batch_export_backfill)( # type: ignore batch_export_id=uuid.UUID(inputs.batch_export_id), start_at=inputs.start_at, end_at=inputs.end_at, @@ -607,7 +607,7 @@ async def update_batch_export_backfill_model_status(inputs: UpdateBatchExportBac """Activity that updates the status of an BatchExportRun.""" backfill = await sync_to_async(update_batch_export_backfill_status)( backfill_id=uuid.UUID(inputs.id), status=inputs.status - ) + ) # type: ignore logger = await bind_temporal_worker_logger(team_id=backfill.team_id) if backfill.status == "Failed": diff --git a/posthog/temporal/data_imports/external_data_job.py b/posthog/temporal/data_imports/external_data_job.py index e94e1b41cd54d..49b94f268279a 100644 --- a/posthog/temporal/data_imports/external_data_job.py +++ b/posthog/temporal/data_imports/external_data_job.py @@ -38,24 +38,24 @@ class CreateExternalDataJobInputs: @activity.defn async def create_external_data_job_model(inputs: CreateExternalDataJobInputs) -> Tuple[str, list[str]]: - run = await sync_to_async(create_external_data_job)( + run = await sync_to_async(create_external_data_job)( # type: ignore team_id=inputs.team_id, external_data_source_id=inputs.external_data_source_id, workflow_id=activity.info().workflow_id, ) - source = await sync_to_async(ExternalDataSource.objects.get)( + source = await sync_to_async(ExternalDataSource.objects.get)( # type: ignore team_id=inputs.team_id, id=inputs.external_data_source_id ) # Sync schemas if they have changed - await sync_to_async(sync_old_schemas_with_new_schemas)( - list(PIPELINE_TYPE_SCHEMA_DEFAULT_MAPPING[source.source_type]), + await sync_to_async(sync_old_schemas_with_new_schemas)( # type: ignore + list(PIPELINE_TYPE_SCHEMA_DEFAULT_MAPPING[source.source_type]), # type: ignore source_id=inputs.external_data_source_id, team_id=inputs.team_id, ) - schemas = await sync_to_async(get_active_schemas_for_source_id)( + schemas = await sync_to_async(get_active_schemas_for_source_id)( # type: ignore team_id=inputs.team_id, source_id=inputs.external_data_source_id ) @@ -79,7 +79,7 @@ class UpdateExternalDataJobStatusInputs: @activity.defn async def update_external_data_job_model(inputs: UpdateExternalDataJobStatusInputs) -> None: - await sync_to_async(update_external_job_status)( + await sync_to_async(update_external_job_status)( # type: ignore run_id=uuid.UUID(inputs.id), status=inputs.status, latest_error=inputs.latest_error, @@ -101,7 +101,7 @@ class ValidateSchemaInputs: @activity.defn async def validate_schema_activity(inputs: ValidateSchemaInputs) -> None: - await sync_to_async(validate_schema_and_update_table)( + await sync_to_async(validate_schema_and_update_table)( # type: ignore run_id=inputs.run_id, team_id=inputs.team_id, schemas=inputs.schemas, @@ -129,7 +129,7 @@ class ExternalDataJobInputs: @activity.defn async def run_external_data_job(inputs: ExternalDataJobInputs) -> None: - model: ExternalDataJob = await sync_to_async(get_external_data_job)( + model: ExternalDataJob = await sync_to_async(get_external_data_job)( # type: ignore team_id=inputs.team_id, run_id=inputs.run_id, ) diff --git a/posthog/temporal/tests/conftest.py b/posthog/temporal/tests/conftest.py index 4e1b106717194..48b0893c1ad0d 100644 --- a/posthog/temporal/tests/conftest.py +++ b/posthog/temporal/tests/conftest.py @@ -40,21 +40,21 @@ def team(organization): @pytest_asyncio.fixture async def aorganization(): name = f"BatchExportsTestOrg-{random.randint(1, 99999)}" - org = await sync_to_async(Organization.objects.create)(name=name) + org = await sync_to_async(Organization.objects.create)(name=name) # type: ignore yield org - await sync_to_async(org.delete)() + await sync_to_async(org.delete)() # type: ignore @pytest_asyncio.fixture async def ateam(aorganization): name = f"BatchExportsTestTeam-{random.randint(1, 99999)}" - team = await sync_to_async(Team.objects.create)(organization=aorganization, name=name) + team = await sync_to_async(Team.objects.create)(organization=aorganization, name=name) # type: ignore yield team - await sync_to_async(team.delete)() + await sync_to_async(team.delete)() # type: ignore @pytest.fixture diff --git a/posthog/temporal/tests/test_external_data_job.py b/posthog/temporal/tests/test_external_data_job.py index 393dbde670810..44d153967cd7d 100644 --- a/posthog/temporal/tests/test_external_data_job.py +++ b/posthog/temporal/tests/test_external_data_job.py @@ -59,14 +59,14 @@ async def test_create_external_job_activity(activity_environment, team, **kwargs team=team, status="running", source_type="Stripe", - ) + ) # type: ignore inputs = CreateExternalDataJobInputs(team_id=team.id, external_data_source_id=new_source.pk) run_id, schemas = await activity_environment.run(create_external_data_job_model, inputs) runs = ExternalDataJob.objects.filter(id=run_id) - assert await sync_to_async(runs.exists)() + assert await sync_to_async(runs.exists)() # type:ignore assert len(schemas) == len(PIPELINE_TYPE_SCHEMA_DEFAULT_MAPPING[new_source.source_type]) @@ -83,15 +83,15 @@ async def test_create_external_job_activity_schemas_exist(activity_environment, team=team, status="running", source_type="Stripe", - ) + ) # type: ignore - await sync_to_async(ExternalDataSchema.objects.create)( + await sync_to_async(ExternalDataSchema.objects.create)( # type: ignore name=PIPELINE_TYPE_SCHEMA_DEFAULT_MAPPING[new_source.source_type][0], team_id=team.id, source_id=new_source.pk, ) - await sync_to_async(ExternalDataSchema.objects.create)( + await sync_to_async(ExternalDataSchema.objects.create)( # type: ignore name=PIPELINE_TYPE_SCHEMA_DEFAULT_MAPPING[new_source.source_type][1], team_id=team.id, source_id=new_source.pk, @@ -103,7 +103,7 @@ async def test_create_external_job_activity_schemas_exist(activity_environment, run_id, schemas = await activity_environment.run(create_external_data_job_model, inputs) runs = ExternalDataJob.objects.filter(id=run_id) - assert await sync_to_async(runs.exists)() + assert await sync_to_async(runs.exists)() # type:ignore # one less schema because one of the schemas is turned off assert len(schemas) == len(PIPELINE_TYPE_SCHEMA_DEFAULT_MAPPING[new_source.source_type]) - 1 @@ -121,11 +121,11 @@ async def test_update_external_job_activity(activity_environment, team, **kwargs team=team, status="running", source_type="Stripe", - ) + ) # type: ignore new_job = await sync_to_async(create_external_data_job)( team_id=team.id, external_data_source_id=new_source.pk, workflow_id=activity_environment.info.workflow_id - ) + ) # type: ignore inputs = UpdateExternalDataJobStatusInputs( id=str(new_job.id), @@ -136,7 +136,7 @@ async def test_update_external_job_activity(activity_environment, team, **kwargs ) await activity_environment.run(update_external_data_job_model, inputs) - await sync_to_async(new_job.refresh_from_db)() + await sync_to_async(new_job.refresh_from_db)() # type: ignore assert new_job.status == ExternalDataJob.Status.COMPLETED @@ -152,16 +152,16 @@ async def test_run_stripe_job(activity_environment, team, **kwargs): status="running", source_type="Stripe", job_inputs={"stripe_secret_key": "test-key"}, - ) + ) # type: ignore - new_job: ExternalDataJob = await sync_to_async(ExternalDataJob.objects.create)( + new_job: ExternalDataJob = await sync_to_async(ExternalDataJob.objects.create)( # type: ignore team_id=team.id, pipeline_id=new_source.pk, status=ExternalDataJob.Status.RUNNING, rows_synced=0, ) - new_job = await sync_to_async(ExternalDataJob.objects.filter(id=new_job.id).prefetch_related("pipeline").get)() + new_job = await sync_to_async(ExternalDataJob.objects.filter(id=new_job.id).prefetch_related("pipeline").get)() # type: ignore inputs = ExternalDataJobInputs( team_id=team.id, @@ -201,9 +201,9 @@ async def test_validate_schema_and_update_table_activity(activity_environment, t status="running", source_type="Stripe", job_inputs={"stripe_secret_key": "test-key"}, - ) + ) # type: ignore - new_job = await sync_to_async(ExternalDataJob.objects.create)( + new_job = await sync_to_async(ExternalDataJob.objects.create)( # type: ignore team_id=team.id, pipeline_id=new_source.pk, status=ExternalDataJob.Status.RUNNING, @@ -235,9 +235,9 @@ async def test_create_schema_activity(activity_environment, team, **kwargs): status="running", source_type="Stripe", job_inputs={"stripe_secret_key": "test-key"}, - ) + ) # type: ignore - new_job = await sync_to_async(ExternalDataJob.objects.create)( + new_job = await sync_to_async(ExternalDataJob.objects.create)( # type: ignore team_id=team.id, pipeline_id=new_source.pk, status=ExternalDataJob.Status.RUNNING, @@ -257,7 +257,7 @@ async def test_create_schema_activity(activity_environment, team, **kwargs): assert mock_get_columns.call_count == 10 all_tables = DataWarehouseTable.objects.all() - table_length = await sync_to_async(len)(all_tables) + table_length = await sync_to_async(len)(all_tables) # type: ignore assert table_length == 5 @@ -276,7 +276,7 @@ async def test_external_data_job_workflow_blank(team, **kwargs): status="running", source_type="Stripe", job_inputs={"stripe_secret_key": "test-key"}, - ) + ) # type: ignore workflow_id = str(uuid.uuid4()) inputs = ExternalDataWorkflowInputs( @@ -307,7 +307,7 @@ async def test_external_data_job_workflow_blank(team, **kwargs): retry_policy=RetryPolicy(maximum_attempts=1), ) - run = await sync_to_async(get_latest_run_if_exists)(team_id=team.pk, pipeline_id=new_source.pk) + run = await sync_to_async(get_latest_run_if_exists)(team_id=team.pk, pipeline_id=new_source.pk) # type: ignore assert run is not None assert run.status == ExternalDataJob.Status.COMPLETED @@ -326,7 +326,7 @@ async def test_external_data_job_workflow_with_schema(team, **kwargs): status="running", source_type="Stripe", job_inputs={"stripe_secret_key": "test-key"}, - ) + ) # type: ignore workflow_id = str(uuid.uuid4()) inputs = ExternalDataWorkflowInputs( @@ -362,11 +362,11 @@ async def mock_async_func(inputs): retry_policy=RetryPolicy(maximum_attempts=1), ) - run = await sync_to_async(get_latest_run_if_exists)(team_id=team.pk, pipeline_id=new_source.pk) + run = await sync_to_async(get_latest_run_if_exists)(team_id=team.pk, pipeline_id=new_source.pk) # type: ignore assert run is not None assert run.status == ExternalDataJob.Status.COMPLETED - assert await sync_to_async(DataWarehouseTable.objects.filter(external_data_source_id=new_source.pk).count)() == len( + assert await sync_to_async(DataWarehouseTable.objects.filter(external_data_source_id=new_source.pk).count)() == len( # type: ignore PIPELINE_TYPE_SCHEMA_DEFAULT_MAPPING[new_source.source_type] ) diff --git a/posthog/temporal/tests/utils/models.py b/posthog/temporal/tests/utils/models.py index 65b40e91332c6..58598ca8c6188 100644 --- a/posthog/temporal/tests/utils/models.py +++ b/posthog/temporal/tests/utils/models.py @@ -29,7 +29,7 @@ def create_batch_export(team_id: int, interval: str, name: str, destination_data async def acreate_batch_export(team_id: int, interval: str, name: str, destination_data: dict) -> BatchExport: """Async create a BatchExport and its underlying Schedule.""" - return await sync_to_async(create_batch_export)(team_id, interval, name, destination_data) + return await sync_to_async(create_batch_export)(team_id, interval, name, destination_data) # type: ignore async def adelete_batch_export(batch_export: BatchExport, temporal_client: temporalio.client.Client) -> None: @@ -42,7 +42,7 @@ async def adelete_batch_export(batch_export: BatchExport, temporal_client: tempo # This means the schedule was already deleted, so we can continue pass - await sync_to_async(batch_export.delete)() + await sync_to_async(batch_export.delete)() # type: ignore def fetch_batch_export_runs(batch_export_id: uuid.UUID, limit: int = 100) -> list[BatchExportRun]: @@ -52,7 +52,7 @@ def fetch_batch_export_runs(batch_export_id: uuid.UUID, limit: int = 100) -> lis async def afetch_batch_export_runs(batch_export_id: uuid.UUID, limit: int = 100) -> list[BatchExportRun]: """Async fetch the BatchExportRuns for a given BatchExport.""" - return await sync_to_async(fetch_batch_export_runs)(batch_export_id, limit) + return await sync_to_async(fetch_batch_export_runs)(batch_export_id, limit) # type: ignore def fetch_batch_export_backfills(batch_export_id: uuid.UUID, limit: int = 100) -> list[BatchExportBackfill]: @@ -62,4 +62,4 @@ def fetch_batch_export_backfills(batch_export_id: uuid.UUID, limit: int = 100) - async def afetch_batch_export_backfills(batch_export_id: uuid.UUID, limit: int = 100) -> list[BatchExportBackfill]: """Fetch the BatchExportBackfills for a given BatchExport.""" - return await sync_to_async(fetch_batch_export_backfills)(batch_export_id, limit) + return await sync_to_async(fetch_batch_export_backfills)(batch_export_id, limit) # type: ignore diff --git a/posthog/test/__snapshots__/test_feature_flag.ambr b/posthog/test/__snapshots__/test_feature_flag.ambr index d4fdc1d0dd005..cc8c0d48fa7ad 100644 --- a/posthog/test/__snapshots__/test_feature_flag.ambr +++ b/posthog/test/__snapshots__/test_feature_flag.ambr @@ -374,27 +374,27 @@ # name: TestFeatureFlagMatcher.test_numeric_operator_with_cohorts_and_nested_cohorts.1 ' SELECT (((("posthog_person"."properties" -> 'number') > '"100"' - AND JSONB_TYPEOF(("posthog_person"."properties" -> 'number')) = ('string')) + AND JSONB_TYPEOF(("posthog_person"."properties" -> 'number')) = 'string') OR (("posthog_person"."properties" -> 'number') > '100.0' - AND JSONB_TYPEOF(("posthog_person"."properties" -> 'number')) = ('number'))) + AND JSONB_TYPEOF(("posthog_person"."properties" -> 'number')) = 'number')) AND "posthog_person"."properties" ? 'number' AND NOT (("posthog_person"."properties" -> 'number') = 'null')) AS "flag_X_condition_0", (((("posthog_person"."properties" -> 'version') > '"1.05"' - AND JSONB_TYPEOF(("posthog_person"."properties" -> 'version')) = ('string')) + AND JSONB_TYPEOF(("posthog_person"."properties" -> 'version')) = 'string') OR (("posthog_person"."properties" -> 'version') > '1.05' - AND JSONB_TYPEOF(("posthog_person"."properties" -> 'version')) = ('number'))) + AND JSONB_TYPEOF(("posthog_person"."properties" -> 'version')) = 'number')) AND "posthog_person"."properties" ? 'version' AND NOT (("posthog_person"."properties" -> 'version') = 'null')) AS "flag_X_condition_0", (((("posthog_person"."properties" -> 'number') < '"31"' - AND JSONB_TYPEOF(("posthog_person"."properties" -> 'number')) = ('string')) + AND JSONB_TYPEOF(("posthog_person"."properties" -> 'number')) = 'string') OR (("posthog_person"."properties" -> 'number') < '31.0' - AND JSONB_TYPEOF(("posthog_person"."properties" -> 'number')) = ('number'))) + AND JSONB_TYPEOF(("posthog_person"."properties" -> 'number')) = 'number')) AND "posthog_person"."properties" ? 'number' AND NOT (("posthog_person"."properties" -> 'number') = 'null') AND ((("posthog_person"."properties" -> 'nested_prop') > '"20"' - AND JSONB_TYPEOF(("posthog_person"."properties" -> 'nested_prop')) = ('string')) + AND JSONB_TYPEOF(("posthog_person"."properties" -> 'nested_prop')) = 'string') OR (("posthog_person"."properties" -> 'nested_prop') > '20.0' - AND JSONB_TYPEOF(("posthog_person"."properties" -> 'nested_prop')) = ('number'))) + AND JSONB_TYPEOF(("posthog_person"."properties" -> 'nested_prop')) = 'number')) AND "posthog_person"."properties" ? 'nested_prop' AND NOT (("posthog_person"."properties" -> 'nested_prop') = 'null')) AS "flag_X_condition_0" FROM "posthog_person" @@ -419,9 +419,9 @@ # name: TestFeatureFlagMatcher.test_numeric_operator_with_groups_and_person_flags.1 ' SELECT (((("posthog_person"."properties" -> 'number') >= '"20"' - AND JSONB_TYPEOF(("posthog_person"."properties" -> 'number')) = ('string')) + AND JSONB_TYPEOF(("posthog_person"."properties" -> 'number')) = 'string') OR (("posthog_person"."properties" -> 'number') >= '20.0' - AND JSONB_TYPEOF(("posthog_person"."properties" -> 'number')) = ('number'))) + AND JSONB_TYPEOF(("posthog_person"."properties" -> 'number')) = 'number')) AND "posthog_person"."properties" ? 'number' AND NOT (("posthog_person"."properties" -> 'number') = 'null')) AS "flag_X_condition_0" FROM "posthog_person" @@ -434,9 +434,9 @@ # name: TestFeatureFlagMatcher.test_numeric_operator_with_groups_and_person_flags.2 ' SELECT (((("posthog_group"."group_properties" -> 'number') > '"100"' - AND JSONB_TYPEOF(("posthog_group"."group_properties" -> 'number')) = ('string')) + AND JSONB_TYPEOF(("posthog_group"."group_properties" -> 'number')) = 'string') OR (("posthog_group"."group_properties" -> 'number') > '100.0' - AND JSONB_TYPEOF(("posthog_group"."group_properties" -> 'number')) = ('number'))) + AND JSONB_TYPEOF(("posthog_group"."group_properties" -> 'number')) = 'number')) AND "posthog_group"."group_properties" ? 'number' AND NOT (("posthog_group"."group_properties" -> 'number') = 'null')) AS "flag_X_condition_0" FROM "posthog_group" @@ -584,27 +584,27 @@ # name: TestFeatureFlagMatcher.test_with_sql_injection_properties_and_other_aliases.3 ' SELECT (((("posthog_person"."properties" -> 'number space') > '"100"' - AND JSONB_TYPEOF(("posthog_person"."properties" -> 'number space')) = ('string')) + AND JSONB_TYPEOF(("posthog_person"."properties" -> 'number space')) = 'string') OR (("posthog_person"."properties" -> 'number space') > '100.0' - AND JSONB_TYPEOF(("posthog_person"."properties" -> 'number space')) = ('number'))) + AND JSONB_TYPEOF(("posthog_person"."properties" -> 'number space')) = 'number')) AND "posthog_person"."properties" ? 'number space' AND NOT (("posthog_person"."properties" -> 'number space') = 'null') - AND ((JSONB_TYPEOF(("posthog_person"."properties" -> ';''" SELECT 1; DROP TABLE posthog_featureflag;')) = ('string') + AND ((JSONB_TYPEOF(("posthog_person"."properties" -> ';''" SELECT 1; DROP TABLE posthog_featureflag;')) = 'string' AND ("posthog_person"."properties" -> ';''" SELECT 1; DROP TABLE posthog_featureflag;') > '"100"') - OR (JSONB_TYPEOF(("posthog_person"."properties" -> ';''" SELECT 1; DROP TABLE posthog_featureflag;')) = ('number') + OR (JSONB_TYPEOF(("posthog_person"."properties" -> ';''" SELECT 1; DROP TABLE posthog_featureflag;')) = 'number' AND ("posthog_person"."properties" -> ';''" SELECT 1; DROP TABLE posthog_featureflag;') > '100.0')) AND "posthog_person"."properties" ? ';''" SELECT 1; DROP TABLE posthog_featureflag;' AND NOT (("posthog_person"."properties" -> ';''" SELECT 1; DROP TABLE posthog_featureflag;') = 'null')) AS "flag_X_condition_0", - (((JSONB_TYPEOF(("posthog_person"."properties" -> ';''" SELECT 1; DROP TABLE posthog_featureflag;')) = ('string') + (((JSONB_TYPEOF(("posthog_person"."properties" -> ';''" SELECT 1; DROP TABLE posthog_featureflag;')) = 'string' AND ("posthog_person"."properties" -> ';''" SELECT 1; DROP TABLE posthog_featureflag;') > '"100"') - OR (JSONB_TYPEOF(("posthog_person"."properties" -> ';''" SELECT 1; DROP TABLE posthog_featureflag;')) = ('number') + OR (JSONB_TYPEOF(("posthog_person"."properties" -> ';''" SELECT 1; DROP TABLE posthog_featureflag;')) = 'number' AND ("posthog_person"."properties" -> ';''" SELECT 1; DROP TABLE posthog_featureflag;') > '100.0')) AND "posthog_person"."properties" ? ';''" SELECT 1; DROP TABLE posthog_featureflag;' AND NOT (("posthog_person"."properties" -> ';''" SELECT 1; DROP TABLE posthog_featureflag;') = 'null')) AS "flag_X_condition_1", (((("posthog_person"."properties" -> 'version!!!') > '"1.05"' - AND JSONB_TYPEOF(("posthog_person"."properties" -> 'version!!!')) = ('string')) + AND JSONB_TYPEOF(("posthog_person"."properties" -> 'version!!!')) = 'string') OR (("posthog_person"."properties" -> 'version!!!') > '1.05' - AND JSONB_TYPEOF(("posthog_person"."properties" -> 'version!!!')) = ('number'))) + AND JSONB_TYPEOF(("posthog_person"."properties" -> 'version!!!')) = 'number')) AND "posthog_person"."properties" ? 'version!!!' AND NOT (("posthog_person"."properties" -> 'version!!!') = 'null')) AS "flag_X_condition_2", ((("posthog_person"."properties" -> 'nested_prop --random #comment //test') = '"21"' diff --git a/requirements-dev.in b/requirements-dev.in index 3e351bc48a8fe..290af187070f1 100644 --- a/requirements-dev.in +++ b/requirements-dev.in @@ -12,7 +12,7 @@ -c requirements.txt ruff>=0.1.2 -pip-tools~=7.3.0 +pip-tools==6.13.0 mypy==0.981 mypy-extensions==0.4.3 datamodel-code-generator==0.21.5 diff --git a/requirements-dev.txt b/requirements-dev.txt index dec2b471903bf..596db7e5fed12 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -10,7 +10,7 @@ annotated-types==0.5.0 # pydantic argcomplete==2.0.0 # via datamodel-code-generator -asgiref==3.7.2 +asgiref==3.3.2 # via # -c requirements.txt # django @@ -69,7 +69,7 @@ cryptography==37.0.2 # urllib3 datamodel-code-generator==0.21.5 # via -r requirements-dev.in -django==4.1.13 +django==3.2.19 # via # -c requirements.txt # django-stubs @@ -166,7 +166,7 @@ pathable==0.4.3 # via jsonschema-spec pathspec==0.9.0 # via black -pip-tools==7.3.0 +pip-tools==6.13.0 # via -r requirements-dev.in platformdirs==2.5.2 # via black @@ -241,6 +241,10 @@ python-dateutil==2.8.2 # -r requirements-dev.in # faker # freezegun +pytz==2023.3 + # via + # -c requirements.txt + # django pyyaml==6.0 # via # -c requirements.txt @@ -294,7 +298,6 @@ tomli==1.2.3 # black # build # mypy - # pip-tools # pyproject-hooks # pytest types-freezegun==1.1.10 @@ -318,7 +321,6 @@ types-retry==0.9.9.4 typing-extensions==4.7.1 # via # -c requirements.txt - # asgiref # django-stubs # django-stubs-ext # djangorestframework-stubs diff --git a/requirements.in b/requirements.in index db54e704e18b8..655539e4497e2 100644 --- a/requirements.in +++ b/requirements.in @@ -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==3.2.19 django-axes==5.9.0 django-cors-headers==3.5.0 django-deprecate-fields==0.1.1 diff --git a/requirements.txt b/requirements.txt index 625f0937a8f64..388b8362d75bf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -31,7 +31,7 @@ annotated-types==0.5.0 # via pydantic antlr4-python3-runtime==4.13.1 # via -r requirements.in -asgiref==3.7.2 +asgiref==3.3.2 # via django asn1crypto==1.5.1 # via @@ -140,7 +140,7 @@ deprecated==1.2.14 # via dlt dj-database-url==0.5.0 # via -r requirements.in -django==4.1.13 +django==3.2.19 # via # -r requirements.in # django-axes @@ -459,6 +459,7 @@ pytz==2023.3 # via # -r requirements.in # clickhouse-driver + # django # djangorestframework # dlt # infi-clickhouse-orm @@ -594,7 +595,6 @@ types-setuptools==69.0.0.0 # via requirements-parser typing-extensions==4.7.1 # via - # asgiref # dlt # psycopg # pydantic