diff --git a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr index 27dc42ed1593d..d88a47fef28c9 100644 --- a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr +++ b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr @@ -84,7 +84,17 @@ # --- # name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.10 ''' - SELECT "posthog_dashboardtile"."dashboard_id" + SELECT "posthog_dashboardtile"."id", + "posthog_dashboardtile"."dashboard_id", + "posthog_dashboardtile"."insight_id", + "posthog_dashboardtile"."text_id", + "posthog_dashboardtile"."layouts", + "posthog_dashboardtile"."color", + "posthog_dashboardtile"."filters_hash", + "posthog_dashboardtile"."last_refresh", + "posthog_dashboardtile"."refreshing", + "posthog_dashboardtile"."refresh_attempt", + "posthog_dashboardtile"."deleted" FROM "posthog_dashboardtile" INNER JOIN "posthog_dashboard" ON ("posthog_dashboardtile"."dashboard_id" = "posthog_dashboard"."id") WHERE (NOT ("posthog_dashboardtile"."deleted" @@ -94,6 +104,17 @@ ''' # --- # name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.11 + ''' + SELECT "posthog_dashboardtile"."dashboard_id" + FROM "posthog_dashboardtile" + INNER JOIN "posthog_dashboard" ON ("posthog_dashboardtile"."dashboard_id" = "posthog_dashboard"."id") + WHERE (NOT ("posthog_dashboardtile"."deleted" + AND "posthog_dashboardtile"."deleted" IS NOT NULL) + AND NOT ("posthog_dashboard"."deleted") + AND "posthog_dashboardtile"."insight_id" = 2) /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ + ''' +# --- +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.12 ''' SELECT "posthog_dashboard"."id", "posthog_dashboard"."name", @@ -120,7 +141,7 @@ 5 /* ... */)) /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.12 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.13 ''' SELECT "posthog_tag"."name" FROM "posthog_taggeditem" @@ -128,7 +149,7 @@ WHERE "posthog_taggeditem"."insight_id" = 2 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.13 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.14 ''' SELECT "posthog_user"."id", "posthog_user"."password", @@ -159,7 +180,7 @@ LIMIT 21 /**/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.14 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.15 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -211,7 +232,7 @@ LIMIT 21 /*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'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.15 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.16 ''' SELECT "posthog_organizationmembership"."id", "posthog_organizationmembership"."organization_id", @@ -241,7 +262,7 @@ WHERE "posthog_organizationmembership"."user_id" = 2 /*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'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.16 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.17 ''' SELECT "posthog_organization"."id", "posthog_organization"."name", @@ -265,7 +286,7 @@ LIMIT 21 /*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'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.17 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.18 ''' SELECT "posthog_dashboard"."id", "posthog_dashboard"."name", @@ -387,7 +408,7 @@ LIMIT 21 /*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'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.18 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.19 ''' SELECT "posthog_taggeditem"."id", "posthog_taggeditem"."tag_id", @@ -409,24 +430,6 @@ 5 /* ... */) /*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'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.19 - ''' - SELECT "posthog_sharingconfiguration"."id", - "posthog_sharingconfiguration"."team_id", - "posthog_sharingconfiguration"."dashboard_id", - "posthog_sharingconfiguration"."insight_id", - "posthog_sharingconfiguration"."recording_id", - "posthog_sharingconfiguration"."created_at", - "posthog_sharingconfiguration"."enabled", - "posthog_sharingconfiguration"."access_token" - FROM "posthog_sharingconfiguration" - WHERE "posthog_sharingconfiguration"."dashboard_id" IN (1, - 2, - 3, - 4, - 5 /* ... */) /*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'*/ - ''' -# --- # name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.2 ''' SELECT "posthog_organizationmembership"."id", @@ -458,6 +461,24 @@ ''' # --- # name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.20 + ''' + SELECT "posthog_sharingconfiguration"."id", + "posthog_sharingconfiguration"."team_id", + "posthog_sharingconfiguration"."dashboard_id", + "posthog_sharingconfiguration"."insight_id", + "posthog_sharingconfiguration"."recording_id", + "posthog_sharingconfiguration"."created_at", + "posthog_sharingconfiguration"."enabled", + "posthog_sharingconfiguration"."access_token" + FROM "posthog_sharingconfiguration" + WHERE "posthog_sharingconfiguration"."dashboard_id" IN (1, + 2, + 3, + 4, + 5 /* ... */) /*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'*/ + ''' +# --- +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.21 ''' SELECT "posthog_dashboardtile"."id", "posthog_dashboardtile"."dashboard_id", @@ -630,7 +651,7 @@ 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'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.21 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.22 ''' SELECT "posthog_insightcachingstate"."id", "posthog_insightcachingstate"."team_id", @@ -651,7 +672,7 @@ 5 /* ... */) /*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'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.22 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.23 ''' SELECT ("posthog_dashboardtile"."insight_id") AS "_prefetch_related_val_insight_id", "posthog_dashboard"."id", @@ -758,7 +779,7 @@ 5 /* ... */)) /*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'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.23 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.24 ''' SELECT "posthog_dashboardtile"."id", "posthog_dashboardtile"."dashboard_id", @@ -783,7 +804,7 @@ 5 /* ... */)) /*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'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.24 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.25 ''' SELECT "posthog_dashboard"."id", "posthog_dashboard"."name", @@ -809,7 +830,7 @@ 5 /* ... */) /*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'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.25 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.26 ''' SELECT "posthog_dashboardtile"."id", "posthog_dashboardtile"."dashboard_id", @@ -983,7 +1004,7 @@ 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'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.26 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.27 ''' SELECT "posthog_insightcachingstate"."id", "posthog_insightcachingstate"."team_id", @@ -1004,7 +1025,7 @@ 5 /* ... */) /*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'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.27 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.28 ''' SELECT ("posthog_dashboardtile"."insight_id") AS "_prefetch_related_val_insight_id", "posthog_dashboard"."id", @@ -1111,7 +1132,7 @@ 5 /* ... */)) /*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'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.28 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.29 ''' SELECT "posthog_dashboardtile"."id", "posthog_dashboardtile"."dashboard_id", @@ -1136,7 +1157,18 @@ 5 /* ... */)) /*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'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.29 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.3 + ''' + SELECT "posthog_instancesetting"."id", + "posthog_instancesetting"."key", + "posthog_instancesetting"."raw_value" + FROM "posthog_instancesetting" + WHERE "posthog_instancesetting"."key" = 'constance:posthog:RATE_LIMIT_ENABLED' + ORDER BY "posthog_instancesetting"."id" ASC + LIMIT 1 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ + ''' +# --- +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.30 ''' SELECT "posthog_dashboard"."id", "posthog_dashboard"."name", @@ -1162,31 +1194,7 @@ 5 /* ... */) /*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'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.3 - ''' - SELECT "posthog_dashboard"."id", - "posthog_dashboard"."name", - "posthog_dashboard"."description", - "posthog_dashboard"."team_id", - "posthog_dashboard"."pinned", - "posthog_dashboard"."created_at", - "posthog_dashboard"."created_by_id", - "posthog_dashboard"."deleted", - "posthog_dashboard"."last_accessed_at", - "posthog_dashboard"."filters", - "posthog_dashboard"."creation_mode", - "posthog_dashboard"."restriction_level", - "posthog_dashboard"."deprecated_tags", - "posthog_dashboard"."tags", - "posthog_dashboard"."share_token", - "posthog_dashboard"."is_shared" - FROM "posthog_dashboard" - WHERE (NOT ("posthog_dashboard"."deleted") - AND "posthog_dashboard"."id" = 2) - LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ - ''' -# --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.30 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.31 ''' SELECT "posthog_taggeditem"."id", "posthog_taggeditem"."tag_id", @@ -1208,7 +1216,7 @@ 5 /* ... */) /*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'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.31 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.32 ''' SELECT "posthog_dashboard"."id", "posthog_dashboard"."name", @@ -1236,6 +1244,30 @@ ''' # --- # name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.4 + ''' + SELECT "posthog_dashboard"."id", + "posthog_dashboard"."name", + "posthog_dashboard"."description", + "posthog_dashboard"."team_id", + "posthog_dashboard"."pinned", + "posthog_dashboard"."created_at", + "posthog_dashboard"."created_by_id", + "posthog_dashboard"."deleted", + "posthog_dashboard"."last_accessed_at", + "posthog_dashboard"."filters", + "posthog_dashboard"."creation_mode", + "posthog_dashboard"."restriction_level", + "posthog_dashboard"."deprecated_tags", + "posthog_dashboard"."tags", + "posthog_dashboard"."share_token", + "posthog_dashboard"."is_shared" + FROM "posthog_dashboard" + WHERE (NOT ("posthog_dashboard"."deleted") + AND "posthog_dashboard"."id" = 2) + LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ + ''' +# --- +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.5 ''' SELECT "posthog_dashboard"."id", "posthog_dashboard"."name", @@ -1262,7 +1294,7 @@ 5 /* ... */)) /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.5 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.6 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1321,7 +1353,7 @@ LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.6 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.7 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1380,7 +1412,7 @@ LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.7 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.8 ''' SELECT "posthog_organization"."id", "posthog_organization"."name", @@ -1404,7 +1436,7 @@ LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.8 +# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.9 ''' SELECT "posthog_dashboard"."id", "posthog_dashboard"."name", @@ -1428,27 +1460,6 @@ AND "posthog_dashboardtile"."insight_id" = 2) /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ ''' # --- -# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.9 - ''' - SELECT "posthog_dashboardtile"."id", - "posthog_dashboardtile"."dashboard_id", - "posthog_dashboardtile"."insight_id", - "posthog_dashboardtile"."text_id", - "posthog_dashboardtile"."layouts", - "posthog_dashboardtile"."color", - "posthog_dashboardtile"."filters_hash", - "posthog_dashboardtile"."last_refresh", - "posthog_dashboardtile"."refreshing", - "posthog_dashboardtile"."refresh_attempt", - "posthog_dashboardtile"."deleted" - FROM "posthog_dashboardtile" - INNER JOIN "posthog_dashboard" ON ("posthog_dashboardtile"."dashboard_id" = "posthog_dashboard"."id") - WHERE (NOT ("posthog_dashboardtile"."deleted" - AND "posthog_dashboardtile"."deleted" IS NOT NULL) - AND NOT ("posthog_dashboard"."deleted") - AND "posthog_dashboardtile"."insight_id" = 2) /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ - ''' -# --- # name: TestDashboard.test_listing_dashboards_is_not_nplus1 ''' SELECT "posthog_user"."id",