diff --git a/ee/api/test/__snapshots__/test_organization_resource_access.ambr b/ee/api/test/__snapshots__/test_organization_resource_access.ambr index 98e6953f9694f..ecbd2e7c73618 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 79f2ae80438a2..414c27001f947 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 8aa343d472877..c4ef47873e5f8 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,64 +1705,6 @@ 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", @@ -1793,63 +1735,6 @@ 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 f049fa11b9a0e..0850be9b0daef 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 12888a4afdf3b..440d426a1340a 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 f83d0b0b2ec0e..8b53eb4a014ef 100644 --- a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr +++ b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr @@ -961,6 +961,9 @@ 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'*/ @@ -7351,6 +7354,9 @@ 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'*/ @@ -10019,6 +10025,9 @@ 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 450264b1d768e..285a074e341cc 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) # type: ignore + return await sync_to_async(create_organization)(name) diff --git a/posthog/api/test/test_team.py b/posthog/api/test/test_team.py index 6945defe10b3b..36efe0ec889c2 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) # type: ignore + return await sync_to_async(create_team)(organization, name=name) diff --git a/posthog/middleware.py b/posthog/middleware.py index b480580afad40..34cc6f95c4f70 100644 --- a/posthog/middleware.py +++ b/posthog/middleware.py @@ -362,7 +362,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=None)) + middlewares.append(middleware_class(get_response=get_response)) except MiddlewareNotUsed: pass diff --git a/posthog/models/filters/test/__snapshots__/test_filter.ambr b/posthog/models/filters/test/__snapshots__/test_filter.ambr index 6f37e28782d08..b26e6693f0fc3 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 14d54404ee5c3..f11ed0f263518 100644 --- a/posthog/models/test/test_tagged_item_model.py +++ b/posthog/models/test/test_tagged_item_model.py @@ -1,5 +1,4 @@ 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 @@ -28,7 +27,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(IntegrityError): + with self.assertRaises(ValidationError): TaggedItem.objects.create(dashboard_id=dashboard.id, tag_id=tag.id) def test_uniqueness_constraint_insight(self): @@ -38,7 +37,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(IntegrityError): + with self.assertRaises(ValidationError): TaggedItem.objects.create(insight_id=insight.id, tag_id=tag.id) def test_uniqueness_constraint_event_definition(self): @@ -53,7 +52,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(IntegrityError): + with self.assertRaises(ValidationError): TaggedItem.objects.create(event_definition_id=event_definition.id, tag_id=tag.id) def test_uniqueness_constraint_property_definition(self): @@ -68,7 +67,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(IntegrityError): + with self.assertRaises(ValidationError): TaggedItem.objects.create(property_definition_id=property_definition.id, tag_id=tag.id) def test_uniqueness_constraint_action(self): @@ -76,5 +75,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(IntegrityError): + with self.assertRaises(ValidationError): TaggedItem.objects.create(action_id=action.id, tag_id=tag.id) diff --git a/posthog/settings/access.py b/posthog/settings/access.py index cb7a0ae26809c..1a339e6a54c39 100644 --- a/posthog/settings/access.py +++ b/posthog/settings/access.py @@ -25,6 +25,7 @@ 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 c29ec1a1f6b49..171cd9c90323c 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)( # type: ignore + run = await sync_to_async(create_batch_export_run)( 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)( # type: ignore + run = await sync_to_async(create_batch_export_backfill)( 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 5c8634cb61a6e..724ff4027021c 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)( # type: ignore + run = await sync_to_async(create_external_data_job)( 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)( # type: ignore + source = await sync_to_async(ExternalDataSource.objects.get)( 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)( # type: ignore - list(PIPELINE_TYPE_SCHEMA_DEFAULT_MAPPING[source.source_type]), # type: ignore + await sync_to_async(sync_old_schemas_with_new_schemas)( + list(PIPELINE_TYPE_SCHEMA_DEFAULT_MAPPING[source.source_type]), source_id=inputs.external_data_source_id, team_id=inputs.team_id, ) - schemas = await sync_to_async(get_active_schemas_for_source_id)( # type: ignore + schemas = await sync_to_async(get_active_schemas_for_source_id)( 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)( # type: ignore + await sync_to_async(update_external_job_status)( 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)( # type: ignore + await sync_to_async(validate_schema_and_update_table)( 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)( # type: ignore + model: ExternalDataJob = await sync_to_async(get_external_data_job)( team_id=inputs.team_id, run_id=inputs.run_id, ) diff --git a/posthog/temporal/data_imports/pipelines/stripe/helpers.py b/posthog/temporal/data_imports/pipelines/stripe/helpers.py index 501aa976fbf2f..c0f3839247ded 100644 --- a/posthog/temporal/data_imports/pipelines/stripe/helpers.py +++ b/posthog/temporal/data_imports/pipelines/stripe/helpers.py @@ -74,6 +74,6 @@ async def stripe_get_data( api_key=api_key, created={"gte": start_date, "lt": end_date}, limit=100, - **kwargs, # type: ignore + **kwargs, ) return dict(resource_dict) diff --git a/posthog/temporal/tests/conftest.py b/posthog/temporal/tests/conftest.py index 48b0893c1ad0d..4e1b106717194 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) # type: ignore + org = await sync_to_async(Organization.objects.create)(name=name) yield org - await sync_to_async(org.delete)() # type: ignore + await sync_to_async(org.delete)() @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) # type: ignore + team = await sync_to_async(Team.objects.create)(organization=aorganization, name=name) yield team - await sync_to_async(team.delete)() # type: ignore + await sync_to_async(team.delete)() @pytest.fixture diff --git a/posthog/temporal/tests/test_external_data_job.py b/posthog/temporal/tests/test_external_data_job.py index 780d942f43ca4..2eb34a0fb6dd7 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)() # type:ignore + assert await sync_to_async(runs.exists)() 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)( # type: ignore + await sync_to_async(ExternalDataSchema.objects.create)( 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)( # type: ignore + await sync_to_async(ExternalDataSchema.objects.create)( 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)() # type:ignore + assert await sync_to_async(runs.exists)() # 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)() # type: ignore + await sync_to_async(new_job.refresh_from_db)() 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)( # type: ignore + new_job: ExternalDataJob = await sync_to_async(ExternalDataJob.objects.create)( 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)() # type: ignore + new_job = await sync_to_async(ExternalDataJob.objects.filter(id=new_job.id).prefetch_related("pipeline").get)() inputs = ExternalDataJobInputs( team_id=team.id, @@ -208,9 +208,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)( # type: ignore + new_job = await sync_to_async(ExternalDataJob.objects.create)( team_id=team.id, pipeline_id=new_source.pk, status=ExternalDataJob.Status.RUNNING, @@ -242,9 +242,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)( # type: ignore + new_job = await sync_to_async(ExternalDataJob.objects.create)( team_id=team.id, pipeline_id=new_source.pk, status=ExternalDataJob.Status.RUNNING, @@ -264,7 +264,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) # type: ignore + table_length = await sync_to_async(len)(all_tables) assert table_length == 5 @@ -283,7 +283,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( @@ -314,7 +314,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) # type: ignore + run = await sync_to_async(get_latest_run_if_exists)(team_id=team.pk, pipeline_id=new_source.pk) assert run is not None assert run.status == ExternalDataJob.Status.COMPLETED @@ -333,7 +333,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( @@ -369,11 +369,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) # type: ignore + run = await sync_to_async(get_latest_run_if_exists)(team_id=team.pk, pipeline_id=new_source.pk) 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( # type: ignore + assert await sync_to_async(DataWarehouseTable.objects.filter(external_data_source_id=new_source.pk).count)() == len( 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 58598ca8c6188..65b40e91332c6 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) # type: ignore + return await sync_to_async(create_batch_export)(team_id, interval, name, destination_data) 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)() # type: ignore + await sync_to_async(batch_export.delete)() 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) # type: ignore + return await sync_to_async(fetch_batch_export_runs)(batch_export_id, limit) 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) # type: ignore + return await sync_to_async(fetch_batch_export_backfills)(batch_export_id, limit) diff --git a/posthog/test/__snapshots__/test_feature_flag.ambr b/posthog/test/__snapshots__/test_feature_flag.ambr index cc8c0d48fa7ad..d4fdc1d0dd005 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 290af187070f1..3e351bc48a8fe 100644 --- a/requirements-dev.in +++ b/requirements-dev.in @@ -12,7 +12,7 @@ -c requirements.txt ruff>=0.1.2 -pip-tools==6.13.0 +pip-tools~=7.3.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 596db7e5fed12..dec2b471903bf 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.3.2 +asgiref==3.7.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==3.2.19 +django==4.1.13 # 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==6.13.0 +pip-tools==7.3.0 # via -r requirements-dev.in platformdirs==2.5.2 # via black @@ -241,10 +241,6 @@ 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 @@ -298,6 +294,7 @@ tomli==1.2.3 # black # build # mypy + # pip-tools # pyproject-hooks # pytest types-freezegun==1.1.10 @@ -321,6 +318,7 @@ 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 655539e4497e2..db54e704e18b8 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==3.2.19 +Django==4.1.13 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 388b8362d75bf..625f0937a8f64 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.3.2 +asgiref==3.7.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==3.2.19 +django==4.1.13 # via # -r requirements.in # django-axes @@ -459,7 +459,6 @@ pytz==2023.3 # via # -r requirements.in # clickhouse-driver - # django # djangorestframework # dlt # infi-clickhouse-orm @@ -595,6 +594,7 @@ types-setuptools==69.0.0.0 # via requirements-parser typing-extensions==4.7.1 # via + # asgiref # dlt # psycopg # pydantic