Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(managed-warehouse): guarantee ducklake registration staging cleanup (#87259)

Jakob Homan87e669c4c93e
diff --git a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr
index 572d0425850e..6ac4e7b2ca1c 100644
--- a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr
+++ b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr
@@ -91,6 +91,19 @@
'''
# ---
# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.10
+ '''
+ SELECT COUNT(*) AS "__count"
+ 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"."dashboard_id" = 99999
+ AND NOT ("posthog_dashboardtile"."deleted"
+ AND "posthog_dashboardtile"."deleted" IS NOT NULL))
+ '''
+# ---
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.11
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -123,7 +136,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.11
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.12
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -225,7 +238,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.12
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.13
'''
SELECT "posthog_filesystem"."team_id",
"posthog_filesystem"."id",
@@ -250,7 +263,7 @@
AND "posthog_filesystem"."shortcut" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.13
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.14
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -277,7 +290,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.14
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.15
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -304,7 +317,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.15
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.16
'''
SELECT "posthog_insightvariable"."created_by_id",
"posthog_insightvariable"."created_at",
@@ -323,7 +336,7 @@
WHERE "posthog_insightvariable"."team_id" = 99999
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.16
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.17
'''
SELECT "posthog_dashboardtile"."dashboard_id" AS "dashboard_id"
FROM "posthog_dashboardtile"
@@ -334,7 +347,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# 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",
@@ -367,7 +380,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.18
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.19
'''
SELECT "posthog_tag"."name" AS "tag__name"
FROM "posthog_taggeditem"
@@ -375,52 +388,6 @@
WHERE "posthog_taggeditem"."insight_id" = 99999
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.19
- '''
- SELECT "posthog_user"."id",
- "posthog_user"."password",
- "posthog_user"."last_login",
- "posthog_user"."first_name",
- "posthog_user"."last_name",
- "posthog_user"."is_staff",
- "posthog_user"."date_joined",
- "posthog_user"."uuid",
- "posthog_user"."current_organization_id",
- "posthog_user"."current_team_id",
- "posthog_user"."email",
- "posthog_user"."pending_email",
- "posthog_user"."distinct_id",
- "posthog_user"."is_email_verified",
- "posthog_user"."credentials_reviewed_at",
- "posthog_user"."requested_2fa_reset_at",
- "posthog_user"."has_seen_product_intro_for",
- "posthog_user"."strapi_id",
- "posthog_user"."is_active",
- "posthog_user"."role_at_organization",
- "posthog_user"."theme_mode",
- "posthog_user"."partial_notification_settings",
- "posthog_user"."anonymize_data",
- "posthog_user"."allow_impersonation",
- "posthog_user"."toolbar_mode",
- "posthog_user"."hedgehog_config",
- "posthog_user"."allow_sidebar_suggestions",
- "posthog_user"."shortcut_position",
- "posthog_user"."passkeys_enabled_for_2fa",
- "posthog_user"."hide_mcp_hints",
- "posthog_user"."ui_configuration",
- "posthog_user"."onboarding_skipped_at",
- "posthog_user"."onboarding_skipped_reason",
- "posthog_user"."onboarding_skipped_organization_id",
- "posthog_user"."onboarding_delegated_to_invite_id",
- "posthog_user"."onboarding_delegated_to_organization_id",
- "posthog_user"."onboarding_delegation_accepted_at",
- "posthog_user"."events_column_config",
- "posthog_user"."email_opt_in"
- FROM "posthog_user"
- WHERE ("posthog_user"."is_active"
- AND "posthog_user"."id" = 99999)
- '''
-# ---
# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.2
'''
SELECT "posthog_team"."id",
@@ -563,6 +530,52 @@
'''
# ---
# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.20
+ '''
+ SELECT "posthog_user"."id",
+ "posthog_user"."password",
+ "posthog_user"."last_login",
+ "posthog_user"."first_name",
+ "posthog_user"."last_name",
+ "posthog_user"."is_staff",
+ "posthog_user"."date_joined",
+ "posthog_user"."uuid",
+ "posthog_user"."current_organization_id",
+ "posthog_user"."current_team_id",
+ "posthog_user"."email",
+ "posthog_user"."pending_email",
+ "posthog_user"."distinct_id",
+ "posthog_user"."is_email_verified",
+ "posthog_user"."credentials_reviewed_at",
+ "posthog_user"."requested_2fa_reset_at",
+ "posthog_user"."has_seen_product_intro_for",
+ "posthog_user"."strapi_id",
+ "posthog_user"."is_active",
+ "posthog_user"."role_at_organization",
+ "posthog_user"."theme_mode",
+ "posthog_user"."partial_notification_settings",
+ "posthog_user"."anonymize_data",
+ "posthog_user"."allow_impersonation",
+ "posthog_user"."toolbar_mode",
+ "posthog_user"."hedgehog_config",
+ "posthog_user"."allow_sidebar_suggestions",
+ "posthog_user"."shortcut_position",
+ "posthog_user"."passkeys_enabled_for_2fa",
+ "posthog_user"."hide_mcp_hints",
+ "posthog_user"."ui_configuration",
+ "posthog_user"."onboarding_skipped_at",
+ "posthog_user"."onboarding_skipped_reason",
+ "posthog_user"."onboarding_skipped_organization_id",
+ "posthog_user"."onboarding_delegated_to_invite_id",
+ "posthog_user"."onboarding_delegated_to_organization_id",
+ "posthog_user"."onboarding_delegation_accepted_at",
+ "posthog_user"."events_column_config",
+ "posthog_user"."email_opt_in"
+ FROM "posthog_user"
+ WHERE ("posthog_user"."is_active"
+ AND "posthog_user"."id" = 99999)
+ '''
+# ---
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.21
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -607,7 +620,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.21
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.22
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -748,7 +761,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.22
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.23
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -802,7 +815,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.23
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.24
'''
SELECT "ee_accesscontrol"."id",
"ee_accesscontrol"."team_id",
@@ -827,7 +840,7 @@
AND "ee_accesscontrol"."team_id" = 99999))
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.24
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.25
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -879,7 +892,7 @@
WHERE "posthog_organizationmembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.25
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.26
'''
SELECT "ee_accesscontrol"."team_id" AS "team_id",
"ee_accesscontrol"."resource_id" AS "resource_id",
@@ -892,7 +905,7 @@
AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.26
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.27
'''
SELECT "ee_role"."organization_id" AS "role__organization_id",
"ee_rolemembership"."role_id" AS "role_id"
@@ -901,7 +914,7 @@
WHERE "ee_rolemembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.27
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.28
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -1004,7 +1017,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.28
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.29
'''
SELECT "posthog_sharingconfiguration"."id",
"posthog_sharingconfiguration"."team_id",
@@ -1027,7 +1040,61 @@
5 /* ... */)
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.29
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.3
+ '''
+ SELECT "posthog_organizationmembership"."id",
+ "posthog_organizationmembership"."organization_id",
+ "posthog_organizationmembership"."user_id",
+ "posthog_organizationmembership"."level",
+ "posthog_organizationmembership"."joined_at",
+ "posthog_organizationmembership"."updated_at",
+ "posthog_organizationmembership"."invited_by_id",
+ "posthog_organization"."id",
+ "posthog_organization"."name",
+ "posthog_organization"."slug",
+ "posthog_organization"."logo_media_id",
+ "posthog_organization"."created_at",
+ "posthog_organization"."updated_at",
+ "posthog_organization"."is_active",
+ "posthog_organization"."is_not_active_reason",
+ "posthog_organization"."session_cookie_age",
+ "posthog_organization"."is_member_join_email_enabled",
+ "posthog_organization"."is_ai_data_processing_approved",
+ "posthog_organization"."is_ai_training_opted_in",
+ "posthog_organization"."is_ai_training_locked",
+ "posthog_organization"."is_ai_training_cta_shown",
+ "posthog_organization"."enforce_2fa",
+ "posthog_organization"."enforce_verified_domains",
+ "posthog_organization"."members_can_invite",
+ "posthog_organization"."members_can_create_projects",
+ "posthog_organization"."members_can_use_personal_api_keys",
+ "posthog_organization"."members_can_see_org_members",
+ "posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."default_role_id",
+ "posthog_organization"."plugins_access_level",
+ "posthog_organization"."for_internal_metrics",
+ "posthog_organization"."default_experiment_stats_method",
+ "posthog_organization"."default_anonymize_ips",
+ "posthog_organization"."is_hipaa",
+ "posthog_organization"."is_pending_deletion",
+ "posthog_organization"."customer_id",
+ "posthog_organization"."available_product_features",
+ "posthog_organization"."usage",
+ "posthog_organization"."never_drop_data",
+ "posthog_organization"."customer_trust_scores",
+ "posthog_organization"."has_active_subscription",
+ "posthog_organization"."setup_section_2_completed",
+ "posthog_organization"."personalization",
+ "posthog_organization"."domain_whitelist",
+ "posthog_organization"."is_platform"
+ FROM "posthog_organizationmembership"
+ INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
+ WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
+ AND "posthog_organizationmembership"."user_id" = 99999)
+ LIMIT 21
+ '''
+# ---
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.30
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -1390,61 +1457,7 @@
ORDER BY "posthog_dashboarditem"."order" ASC
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.3
- '''
- SELECT "posthog_organizationmembership"."id",
- "posthog_organizationmembership"."organization_id",
- "posthog_organizationmembership"."user_id",
- "posthog_organizationmembership"."level",
- "posthog_organizationmembership"."joined_at",
- "posthog_organizationmembership"."updated_at",
- "posthog_organizationmembership"."invited_by_id",
- "posthog_organization"."id",
- "posthog_organization"."name",
- "posthog_organization"."slug",
- "posthog_organization"."logo_media_id",
- "posthog_organization"."created_at",
- "posthog_organization"."updated_at",
- "posthog_organization"."is_active",
- "posthog_organization"."is_not_active_reason",
- "posthog_organization"."session_cookie_age",
- "posthog_organization"."is_member_join_email_enabled",
- "posthog_organization"."is_ai_data_processing_approved",
- "posthog_organization"."is_ai_training_opted_in",
- "posthog_organization"."is_ai_training_locked",
- "posthog_organization"."is_ai_training_cta_shown",
- "posthog_organization"."enforce_2fa",
- "posthog_organization"."enforce_verified_domains",
- "posthog_organization"."members_can_invite",
- "posthog_organization"."members_can_create_projects",
- "posthog_organization"."members_can_use_personal_api_keys",
- "posthog_organization"."members_can_see_org_members",
- "posthog_organization"."allow_publicly_shared_resources",
- "posthog_organization"."default_role_id",
- "posthog_organization"."plugins_access_level",
- "posthog_organization"."for_internal_metrics",
- "posthog_organization"."default_experiment_stats_method",
- "posthog_organization"."default_anonymize_ips",
- "posthog_organization"."is_hipaa",
- "posthog_organization"."is_pending_deletion",
- "posthog_organization"."customer_id",
- "posthog_organization"."available_product_features",
- "posthog_organization"."usage",
- "posthog_organization"."never_drop_data",
- "posthog_organization"."customer_trust_scores",
- "posthog_organization"."has_active_subscription",
- "posthog_organization"."setup_section_2_completed",
- "posthog_organization"."personalization",
- "posthog_organization"."domain_whitelist",
- "posthog_organization"."is_platform"
- FROM "posthog_organizationmembership"
- INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
- WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
- AND "posthog_organizationmembership"."user_id" = 99999)
- LIMIT 21
- '''
-# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.30
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.31
'''
SELECT ("posthog_dashboardtile"."insight_id") AS "_prefetch_related_val_insight_id",
"posthog_dashboard"."id",
@@ -1486,7 +1499,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.31
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.32
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -1517,7 +1530,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.32
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.33
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -1546,7 +1559,7 @@
2)/* ... */)
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.33
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.34
'''
SELECT "posthog_taggeditem"."id",
"posthog_taggeditem"."tag_id",
@@ -1573,7 +1586,7 @@
5 /* ... */)
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.34
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.35
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -1675,7 +1688,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.35
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.36
'''
SELECT "posthog_filesystem"."team_id",
"posthog_filesystem"."id",
@@ -1700,7 +1713,7 @@
AND "posthog_filesystem"."shortcut" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.36
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.37
'''
SELECT "posthog_filesystemshortcut"."id",
"posthog_filesystemshortcut"."team_id",
@@ -1723,7 +1736,7 @@
AND "posthog_filesystemshortcut"."href" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.37
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.38
'''
SELECT "posthog_insightvariable"."created_by_id",
"posthog_insightvariable"."created_at",
@@ -1742,7 +1755,7 @@
WHERE "posthog_insightvariable"."team_id" = 99999
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.38
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.39
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -2106,7 +2119,32 @@
ORDER BY "posthog_dashboarditem"."order" ASC
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.39
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.4
+ '''
+ SELECT "ee_accesscontrol"."id",
+ "ee_accesscontrol"."team_id",
+ "ee_accesscontrol"."access_level",
+ "ee_accesscontrol"."resource",
+ "ee_accesscontrol"."resource_id",
+ "ee_accesscontrol"."organization_member_id",
+ "ee_accesscontrol"."role_id",
+ "ee_accesscontrol"."created_by_id",
+ "ee_accesscontrol"."created_at",
+ "ee_accesscontrol"."updated_at",
+ "posthog_team"."organization_id" AS "_team_organization_id"
+ FROM "ee_accesscontrol"
+ INNER JOIN "posthog_team" ON ("ee_accesscontrol"."team_id" = "posthog_team"."id")
+ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id")
+ WHERE (("ee_accesscontrol"."organization_member_id" IS NULL
+ AND "ee_accesscontrol"."role_id" IS NULL
+ AND "ee_accesscontrol"."team_id" = 99999)
+ OR ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
+ AND "posthog_organizationmembership"."user_id" = 99999
+ AND "ee_accesscontrol"."role_id" IS NULL
+ AND "ee_accesscontrol"."team_id" = 99999))
+ '''
+# ---
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.40
'''
SELECT ("posthog_dashboardtile"."insight_id") AS "_prefetch_related_val_insight_id",
"posthog_dashboard"."id",
@@ -2148,32 +2186,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.4
- '''
- SELECT "ee_accesscontrol"."id",
- "ee_accesscontrol"."team_id",
- "ee_accesscontrol"."access_level",
- "ee_accesscontrol"."resource",
- "ee_accesscontrol"."resource_id",
- "ee_accesscontrol"."organization_member_id",
- "ee_accesscontrol"."role_id",
- "ee_accesscontrol"."created_by_id",
- "ee_accesscontrol"."created_at",
- "ee_accesscontrol"."updated_at",
- "posthog_team"."organization_id" AS "_team_organization_id"
- FROM "ee_accesscontrol"
- INNER JOIN "posthog_team" ON ("ee_accesscontrol"."team_id" = "posthog_team"."id")
- LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id")
- WHERE (("ee_accesscontrol"."organization_member_id" IS NULL
- AND "ee_accesscontrol"."role_id" IS NULL
- AND "ee_accesscontrol"."team_id" = 99999)
- OR ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
- AND "posthog_organizationmembership"."user_id" = 99999
- AND "ee_accesscontrol"."role_id" IS NULL
- AND "ee_accesscontrol"."team_id" = 99999))
- '''
-# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.40
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.41
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -2204,7 +2217,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.41
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.42
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -2233,7 +2246,7 @@
2)/* ... */)
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.42
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.43
'''
SELECT "posthog_taggeditem"."id",
"posthog_taggeditem"."tag_id",
@@ -2260,7 +2273,7 @@
5 /* ... */)
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.43
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.44
'''
SELECT "posthog_alertconfiguration"."created_by_id",
"posthog_alertconfiguration"."created_at",
@@ -2341,7 +2354,7 @@
5 /* ... */)
'''
# ---
-# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.44
+# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.45
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -2470,15 +2483,15 @@
# ---
# name: TestDashboard.test_adding_insights_is_not_nplus1_for_gets.9
'''
- SELECT COUNT(*) AS "__count"
- 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"."dashboard_id" = 99999
- AND NOT ("posthog_dashboardtile"."deleted"
- AND "posthog_dashboardtile"."deleted" IS NOT NULL))
+ SELECT "posthog_dashboard"."id" AS "id",
+ "posthog_dashboard"."name" AS "name"
+ FROM "posthog_dashboard"
+ WHERE (NOT ("posthog_dashboard"."deleted")
+ AND "posthog_dashboard"."id" IN (1,
+ 2,
+ 3,
+ 4,
+ 5 /* ... */))
'''
# ---
# name: TestDashboard.test_listing_dashboards_is_not_nplus1
@@ -2573,6 +2586,108 @@
'''
# ---
# name: TestDashboard.test_listing_dashboards_is_not_nplus1.10
+ '''
+ SELECT "posthog_team"."id",
+ "posthog_team"."uuid",
+ "posthog_team"."organization_id",
+ "posthog_team"."parent_team_id",
+ "posthog_team"."project_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"."onboarding_tasks",
+ "posthog_team"."ingested_event",
+ "posthog_team"."ingested_production_event",
+ "posthog_team"."ingested_production_event_last_checked_at",
+ "posthog_team"."person_processing_opt_out",
+ "posthog_team"."secret_api_token",
+ "posthog_team"."secret_api_token_backup",
+ "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"."session_recording_masking_config",
+ "posthog_team"."session_recording_url_trigger_config",
+ "posthog_team"."session_recording_url_blocklist_config",
+ "posthog_team"."session_recording_event_trigger_config",
+ "posthog_team"."session_recording_trigger_match_type_config",
+ "posthog_team"."session_recording_trigger_groups",
+ "posthog_team"."session_replay_config",
+ "posthog_team"."session_recording_retention_period",
+ "posthog_team"."event_retention_months",
+ "posthog_team"."conversations_enabled",
+ "posthog_team"."conversations_settings",
+ "posthog_team"."proactive_tasks_enabled",
+ "posthog_team"."survey_config",
+ "posthog_team"."surveys_opt_in",
+ "posthog_team"."product_tours_opt_in",
+ "posthog_team"."capture_console_log_opt_in",
+ "posthog_team"."capture_performance_opt_in",
+ "posthog_team"."capture_dead_clicks",
+ "posthog_team"."autocapture_opt_out",
+ "posthog_team"."autocapture_web_vitals_opt_in",
+ "posthog_team"."autocapture_web_vitals_allowed_metrics",
+ "posthog_team"."autocapture_exceptions_opt_in",
+ "posthog_team"."autocapture_exceptions_errors_to_ignore",
+ "posthog_team"."logs_settings",
+ "posthog_team"."llm_gateway_enabled_at",
+ "posthog_team"."llm_gateway_revoked_at",
+ "posthog_team"."llm_gateway_overspend_allowance_usd",
+ "posthog_team"."heatmaps_opt_in",
+ "posthog_team"."receive_org_level_activity_logs",
+ "posthog_team"."web_analytics_pre_aggregated_tables_enabled",
+ "posthog_team"."web_analytics_pre_aggregated_tables_version",
+ "posthog_team"."flags_persistence_default",
+ "posthog_team"."feature_flag_confirmation_enabled",
+ "posthog_team"."feature_flag_confirmation_message",
+ "posthog_team"."default_evaluation_environments_enabled",
+ "posthog_team"."require_evaluation_environment_tags",
+ "posthog_team"."default_evaluation_contexts_enabled",
+ "posthog_team"."require_evaluation_contexts",
+ "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"."human_friendly_comparison_periods",
+ "posthog_team"."cookieless_server_hash_mode",
+ "posthog_team"."primary_dashboard_id",
+ "posthog_team"."default_data_theme",
+ "posthog_team"."extra_settings",
+ "posthog_team"."modifiers",
+ "posthog_team"."correlation_config",
+ "posthog_team"."session_recording_retention_period_days",
+ "posthog_team"."external_data_workspace_id",
+ "posthog_team"."external_data_workspace_last_synced_at",
+ "posthog_team"."api_query_rate_limit",
+ "posthog_team"."drop_events_older_than",
+ "posthog_team"."base_currency",
+ "posthog_team"."experiment_recalculation_time",
+ "posthog_team"."default_experiment_confidence_level",
+ "posthog_team"."default_experiment_stats_method",
+ "posthog_team"."business_model"
+ FROM "posthog_team"
+ WHERE "posthog_team"."id" = 99999
+ LIMIT 21
+ '''
+# ---
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.11
'''
SELECT "posthog_filesystem"."team_id",
"posthog_filesystem"."id",
@@ -2597,7 +2712,7 @@
AND "posthog_filesystem"."shortcut" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.11
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.12
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -2642,7 +2757,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.12
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.13
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -2744,7 +2859,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.13
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.14
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -2771,7 +2886,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.14
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.15
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -2798,7 +2913,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.15
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.16
'''
SELECT "posthog_insightvariable"."created_by_id",
"posthog_insightvariable"."created_at",
@@ -2817,7 +2932,7 @@
WHERE "posthog_insightvariable"."team_id" = 99999
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.16
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.17
'''
SELECT "posthog_dashboardtile"."dashboard_id" AS "dashboard_id"
FROM "posthog_dashboardtile"
@@ -2828,7 +2943,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.17
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.18
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -2861,7 +2976,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.18
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.19
'''
SELECT "posthog_tag"."name" AS "tag__name"
FROM "posthog_taggeditem"
@@ -2869,52 +2984,6 @@
WHERE "posthog_taggeditem"."insight_id" = 99999
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.19
- '''
- SELECT "posthog_user"."id",
- "posthog_user"."password",
- "posthog_user"."last_login",
- "posthog_user"."first_name",
- "posthog_user"."last_name",
- "posthog_user"."is_staff",
- "posthog_user"."date_joined",
- "posthog_user"."uuid",
- "posthog_user"."current_organization_id",
- "posthog_user"."current_team_id",
- "posthog_user"."email",
- "posthog_user"."pending_email",
- "posthog_user"."distinct_id",
- "posthog_user"."is_email_verified",
- "posthog_user"."credentials_reviewed_at",
- "posthog_user"."requested_2fa_reset_at",
- "posthog_user"."has_seen_product_intro_for",
- "posthog_user"."strapi_id",
- "posthog_user"."is_active",
- "posthog_user"."role_at_organization",
- "posthog_user"."theme_mode",
- "posthog_user"."partial_notification_settings",
- "posthog_user"."anonymize_data",
- "posthog_user"."allow_impersonation",
- "posthog_user"."toolbar_mode",
- "posthog_user"."hedgehog_config",
- "posthog_user"."allow_sidebar_suggestions",
- "posthog_user"."shortcut_position",
- "posthog_user"."passkeys_enabled_for_2fa",
- "posthog_user"."hide_mcp_hints",
- "posthog_user"."ui_configuration",
- "posthog_user"."onboarding_skipped_at",
- "posthog_user"."onboarding_skipped_reason",
- "posthog_user"."onboarding_skipped_organization_id",
- "posthog_user"."onboarding_delegated_to_invite_id",
- "posthog_user"."onboarding_delegated_to_organization_id",
- "posthog_user"."onboarding_delegation_accepted_at",
- "posthog_user"."events_column_config",
- "posthog_user"."email_opt_in"
- FROM "posthog_user"
- WHERE ("posthog_user"."is_active"
- AND "posthog_user"."id" = 99999)
- '''
-# ---
# name: TestDashboard.test_listing_dashboards_is_not_nplus1.2
'''
SELECT "posthog_team"."id",
@@ -3058,12 +3127,58 @@
# ---
# name: TestDashboard.test_listing_dashboards_is_not_nplus1.20
'''
- SELECT "posthog_organization"."id",
- "posthog_organization"."name",
- "posthog_organization"."slug",
- "posthog_organization"."logo_media_id",
- "posthog_organization"."created_at",
- "posthog_organization"."updated_at",
+ SELECT "posthog_user"."id",
+ "posthog_user"."password",
+ "posthog_user"."last_login",
+ "posthog_user"."first_name",
+ "posthog_user"."last_name",
+ "posthog_user"."is_staff",
+ "posthog_user"."date_joined",
+ "posthog_user"."uuid",
+ "posthog_user"."current_organization_id",
+ "posthog_user"."current_team_id",
+ "posthog_user"."email",
+ "posthog_user"."pending_email",
+ "posthog_user"."distinct_id",
+ "posthog_user"."is_email_verified",
+ "posthog_user"."credentials_reviewed_at",
+ "posthog_user"."requested_2fa_reset_at",
+ "posthog_user"."has_seen_product_intro_for",
+ "posthog_user"."strapi_id",
+ "posthog_user"."is_active",
+ "posthog_user"."role_at_organization",
+ "posthog_user"."theme_mode",
+ "posthog_user"."partial_notification_settings",
+ "posthog_user"."anonymize_data",
+ "posthog_user"."allow_impersonation",
+ "posthog_user"."toolbar_mode",
+ "posthog_user"."hedgehog_config",
+ "posthog_user"."allow_sidebar_suggestions",
+ "posthog_user"."shortcut_position",
+ "posthog_user"."passkeys_enabled_for_2fa",
+ "posthog_user"."hide_mcp_hints",
+ "posthog_user"."ui_configuration",
+ "posthog_user"."onboarding_skipped_at",
+ "posthog_user"."onboarding_skipped_reason",
+ "posthog_user"."onboarding_skipped_organization_id",
+ "posthog_user"."onboarding_delegated_to_invite_id",
+ "posthog_user"."onboarding_delegated_to_organization_id",
+ "posthog_user"."onboarding_delegation_accepted_at",
+ "posthog_user"."events_column_config",
+ "posthog_user"."email_opt_in"
+ FROM "posthog_user"
+ WHERE ("posthog_user"."is_active"
+ AND "posthog_user"."id" = 99999)
+ '''
+# ---
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.21
+ '''
+ SELECT "posthog_organization"."id",
+ "posthog_organization"."name",
+ "posthog_organization"."slug",
+ "posthog_organization"."logo_media_id",
+ "posthog_organization"."created_at",
+ "posthog_organization"."updated_at",
"posthog_organization"."is_active",
"posthog_organization"."is_not_active_reason",
"posthog_organization"."session_cookie_age",
@@ -3101,7 +3216,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.21
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.22
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -3242,7 +3357,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.22
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.23
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -3296,7 +3411,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.23
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.24
'''
SELECT "ee_accesscontrol"."id",
"ee_accesscontrol"."team_id",
@@ -3321,7 +3436,7 @@
AND "ee_accesscontrol"."team_id" = 99999))
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.24
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.25
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -3373,7 +3488,7 @@
WHERE "posthog_organizationmembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.25
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.26
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_dashboard"
@@ -3387,7 +3502,7 @@
AND NOT ("posthog_dashboard"."creation_mode" = 'unlisted'))
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.26
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.27
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -3492,7 +3607,7 @@
LIMIT 300
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.27
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.28
'''
SELECT "posthog_sharingconfiguration"."id",
"posthog_sharingconfiguration"."team_id",
@@ -3515,7 +3630,7 @@
5 /* ... */)
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.28
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.29
'''
SELECT "posthog_taggeditem"."id",
"posthog_taggeditem"."tag_id",
@@ -3694,6 +3809,19 @@
'''
# ---
# name: TestDashboard.test_listing_dashboards_is_not_nplus1.7
+ '''
+ SELECT "posthog_dashboard"."id" AS "id",
+ "posthog_dashboard"."name" AS "name"
+ FROM "posthog_dashboard"
+ WHERE (NOT ("posthog_dashboard"."deleted")
+ AND "posthog_dashboard"."id" IN (1,
+ 2,
+ 3,
+ 4,
+ 5 /* ... */))
+ '''
+# ---
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.8
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_dashboardtile"
@@ -3706,7 +3834,7 @@
AND "posthog_dashboardtile"."deleted" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.8
+# name: TestDashboard.test_listing_dashboards_is_not_nplus1.9
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -3739,108 +3867,6 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_listing_dashboards_is_not_nplus1.9
- '''
- SELECT "posthog_team"."id",
- "posthog_team"."uuid",
- "posthog_team"."organization_id",
- "posthog_team"."parent_team_id",
- "posthog_team"."project_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"."onboarding_tasks",
- "posthog_team"."ingested_event",
- "posthog_team"."ingested_production_event",
- "posthog_team"."ingested_production_event_last_checked_at",
- "posthog_team"."person_processing_opt_out",
- "posthog_team"."secret_api_token",
- "posthog_team"."secret_api_token_backup",
- "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"."session_recording_masking_config",
- "posthog_team"."session_recording_url_trigger_config",
- "posthog_team"."session_recording_url_blocklist_config",
- "posthog_team"."session_recording_event_trigger_config",
- "posthog_team"."session_recording_trigger_match_type_config",
- "posthog_team"."session_recording_trigger_groups",
- "posthog_team"."session_replay_config",
- "posthog_team"."session_recording_retention_period",
- "posthog_team"."event_retention_months",
- "posthog_team"."conversations_enabled",
- "posthog_team"."conversations_settings",
- "posthog_team"."proactive_tasks_enabled",
- "posthog_team"."survey_config",
- "posthog_team"."surveys_opt_in",
- "posthog_team"."product_tours_opt_in",
- "posthog_team"."capture_console_log_opt_in",
- "posthog_team"."capture_performance_opt_in",
- "posthog_team"."capture_dead_clicks",
- "posthog_team"."autocapture_opt_out",
- "posthog_team"."autocapture_web_vitals_opt_in",
- "posthog_team"."autocapture_web_vitals_allowed_metrics",
- "posthog_team"."autocapture_exceptions_opt_in",
- "posthog_team"."autocapture_exceptions_errors_to_ignore",
- "posthog_team"."logs_settings",
- "posthog_team"."llm_gateway_enabled_at",
- "posthog_team"."llm_gateway_revoked_at",
- "posthog_team"."llm_gateway_overspend_allowance_usd",
- "posthog_team"."heatmaps_opt_in",
- "posthog_team"."receive_org_level_activity_logs",
- "posthog_team"."web_analytics_pre_aggregated_tables_enabled",
- "posthog_team"."web_analytics_pre_aggregated_tables_version",
- "posthog_team"."flags_persistence_default",
- "posthog_team"."feature_flag_confirmation_enabled",
- "posthog_team"."feature_flag_confirmation_message",
- "posthog_team"."default_evaluation_environments_enabled",
- "posthog_team"."require_evaluation_environment_tags",
- "posthog_team"."default_evaluation_contexts_enabled",
- "posthog_team"."require_evaluation_contexts",
- "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"."human_friendly_comparison_periods",
- "posthog_team"."cookieless_server_hash_mode",
- "posthog_team"."primary_dashboard_id",
- "posthog_team"."default_data_theme",
- "posthog_team"."extra_settings",
- "posthog_team"."modifiers",
- "posthog_team"."correlation_config",
- "posthog_team"."session_recording_retention_period_days",
- "posthog_team"."external_data_workspace_id",
- "posthog_team"."external_data_workspace_last_synced_at",
- "posthog_team"."api_query_rate_limit",
- "posthog_team"."drop_events_older_than",
- "posthog_team"."base_currency",
- "posthog_team"."experiment_recalculation_time",
- "posthog_team"."default_experiment_confidence_level",
- "posthog_team"."default_experiment_stats_method",
- "posthog_team"."business_model"
- FROM "posthog_team"
- WHERE "posthog_team"."id" = 99999
- LIMIT 21
- '''
-# ---
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles
'''
SELECT "posthog_user"."id",
@@ -3959,63 +3985,235 @@
# ---
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.100
'''
- SELECT "posthog_dashboardtile"."id",
- "posthog_dashboardtile"."dashboard_id",
- "posthog_dashboardtile"."insight_id",
- "posthog_dashboardtile"."text_id",
- "posthog_dashboardtile"."button_tile_id",
- "posthog_dashboardtile"."widget_id",
- "posthog_dashboardtile"."team_id",
- "posthog_dashboardtile"."layouts",
- "posthog_dashboardtile"."color",
- "posthog_dashboardtile"."filters_hash",
- "posthog_dashboardtile"."last_refresh",
- "posthog_dashboardtile"."refreshing",
- "posthog_dashboardtile"."refresh_attempt",
- "posthog_dashboardtile"."filters_overrides",
- "posthog_dashboardtile"."show_description",
- "posthog_dashboardtile"."transparent_background",
- "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" = 99999)
+ SELECT "posthog_filesystem"."team_id",
+ "posthog_filesystem"."id",
+ "posthog_filesystem"."path",
+ "posthog_filesystem"."depth",
+ "posthog_filesystem"."type",
+ "posthog_filesystem"."ref",
+ "posthog_filesystem"."href",
+ "posthog_filesystem"."shortcut",
+ "posthog_filesystem"."meta",
+ "posthog_filesystem"."created_at",
+ "posthog_filesystem"."created_by_id",
+ "posthog_filesystem"."surface",
+ "posthog_filesystem"."project_id"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'insight'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
'''
# ---
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.101
'''
- SELECT "posthog_dashboardtile"."id",
- "posthog_dashboardtile"."dashboard_id",
- "posthog_dashboardtile"."insight_id",
- "posthog_dashboardtile"."text_id",
- "posthog_dashboardtile"."button_tile_id",
- "posthog_dashboardtile"."widget_id",
- "posthog_dashboardtile"."team_id",
- "posthog_dashboardtile"."layouts",
- "posthog_dashboardtile"."color",
- "posthog_dashboardtile"."filters_hash",
- "posthog_dashboardtile"."last_refresh",
- "posthog_dashboardtile"."refreshing",
- "posthog_dashboardtile"."refresh_attempt",
- "posthog_dashboardtile"."filters_overrides",
- "posthog_dashboardtile"."show_description",
- "posthog_dashboardtile"."transparent_background",
- "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" = 99999)
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.102
- '''
- SELECT "posthog_insightvariable"."created_by_id",
- "posthog_insightvariable"."created_at",
- "posthog_insightvariable"."updated_at",
+ SELECT "posthog_organization"."id",
+ "posthog_organization"."name",
+ "posthog_organization"."slug",
+ "posthog_organization"."logo_media_id",
+ "posthog_organization"."created_at",
+ "posthog_organization"."updated_at",
+ "posthog_organization"."is_active",
+ "posthog_organization"."is_not_active_reason",
+ "posthog_organization"."session_cookie_age",
+ "posthog_organization"."is_member_join_email_enabled",
+ "posthog_organization"."is_ai_data_processing_approved",
+ "posthog_organization"."is_ai_training_opted_in",
+ "posthog_organization"."is_ai_training_locked",
+ "posthog_organization"."is_ai_training_cta_shown",
+ "posthog_organization"."enforce_2fa",
+ "posthog_organization"."enforce_verified_domains",
+ "posthog_organization"."members_can_invite",
+ "posthog_organization"."members_can_create_projects",
+ "posthog_organization"."members_can_use_personal_api_keys",
+ "posthog_organization"."members_can_see_org_members",
+ "posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."default_role_id",
+ "posthog_organization"."plugins_access_level",
+ "posthog_organization"."for_internal_metrics",
+ "posthog_organization"."default_experiment_stats_method",
+ "posthog_organization"."default_anonymize_ips",
+ "posthog_organization"."is_hipaa",
+ "posthog_organization"."is_pending_deletion",
+ "posthog_organization"."customer_id",
+ "posthog_organization"."available_product_features",
+ "posthog_organization"."usage",
+ "posthog_organization"."never_drop_data",
+ "posthog_organization"."customer_trust_scores",
+ "posthog_organization"."has_active_subscription",
+ "posthog_organization"."setup_section_2_completed",
+ "posthog_organization"."personalization",
+ "posthog_organization"."domain_whitelist",
+ "posthog_organization"."is_platform"
+ FROM "posthog_organization"
+ WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid
+ LIMIT 21
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.102
+ '''
+ SELECT "posthog_team"."id",
+ "posthog_team"."uuid",
+ "posthog_team"."organization_id",
+ "posthog_team"."parent_team_id",
+ "posthog_team"."project_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"."onboarding_tasks",
+ "posthog_team"."ingested_event",
+ "posthog_team"."ingested_production_event",
+ "posthog_team"."ingested_production_event_last_checked_at",
+ "posthog_team"."person_processing_opt_out",
+ "posthog_team"."secret_api_token",
+ "posthog_team"."secret_api_token_backup",
+ "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"."session_recording_masking_config",
+ "posthog_team"."session_recording_url_trigger_config",
+ "posthog_team"."session_recording_url_blocklist_config",
+ "posthog_team"."session_recording_event_trigger_config",
+ "posthog_team"."session_recording_trigger_match_type_config",
+ "posthog_team"."session_recording_trigger_groups",
+ "posthog_team"."session_replay_config",
+ "posthog_team"."session_recording_retention_period",
+ "posthog_team"."event_retention_months",
+ "posthog_team"."conversations_enabled",
+ "posthog_team"."conversations_settings",
+ "posthog_team"."proactive_tasks_enabled",
+ "posthog_team"."survey_config",
+ "posthog_team"."surveys_opt_in",
+ "posthog_team"."product_tours_opt_in",
+ "posthog_team"."capture_console_log_opt_in",
+ "posthog_team"."capture_performance_opt_in",
+ "posthog_team"."capture_dead_clicks",
+ "posthog_team"."autocapture_opt_out",
+ "posthog_team"."autocapture_web_vitals_opt_in",
+ "posthog_team"."autocapture_web_vitals_allowed_metrics",
+ "posthog_team"."autocapture_exceptions_opt_in",
+ "posthog_team"."autocapture_exceptions_errors_to_ignore",
+ "posthog_team"."logs_settings",
+ "posthog_team"."llm_gateway_enabled_at",
+ "posthog_team"."llm_gateway_revoked_at",
+ "posthog_team"."llm_gateway_overspend_allowance_usd",
+ "posthog_team"."heatmaps_opt_in",
+ "posthog_team"."receive_org_level_activity_logs",
+ "posthog_team"."web_analytics_pre_aggregated_tables_enabled",
+ "posthog_team"."web_analytics_pre_aggregated_tables_version",
+ "posthog_team"."flags_persistence_default",
+ "posthog_team"."feature_flag_confirmation_enabled",
+ "posthog_team"."feature_flag_confirmation_message",
+ "posthog_team"."default_evaluation_environments_enabled",
+ "posthog_team"."require_evaluation_environment_tags",
+ "posthog_team"."default_evaluation_contexts_enabled",
+ "posthog_team"."require_evaluation_contexts",
+ "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"."human_friendly_comparison_periods",
+ "posthog_team"."cookieless_server_hash_mode",
+ "posthog_team"."primary_dashboard_id",
+ "posthog_team"."default_data_theme",
+ "posthog_team"."extra_settings",
+ "posthog_team"."modifiers",
+ "posthog_team"."correlation_config",
+ "posthog_team"."session_recording_retention_period_days",
+ "posthog_team"."external_data_workspace_id",
+ "posthog_team"."external_data_workspace_last_synced_at",
+ "posthog_team"."api_query_rate_limit",
+ "posthog_team"."drop_events_older_than",
+ "posthog_team"."base_currency",
+ "posthog_team"."experiment_recalculation_time",
+ "posthog_team"."default_experiment_confidence_level",
+ "posthog_team"."default_experiment_stats_method",
+ "posthog_team"."business_model"
+ FROM "posthog_team"
+ WHERE "posthog_team"."id" = 99999
+ LIMIT 21
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.103
+ '''
+ SELECT "posthog_dashboardtile"."id",
+ "posthog_dashboardtile"."dashboard_id",
+ "posthog_dashboardtile"."insight_id",
+ "posthog_dashboardtile"."text_id",
+ "posthog_dashboardtile"."button_tile_id",
+ "posthog_dashboardtile"."widget_id",
+ "posthog_dashboardtile"."team_id",
+ "posthog_dashboardtile"."layouts",
+ "posthog_dashboardtile"."color",
+ "posthog_dashboardtile"."filters_hash",
+ "posthog_dashboardtile"."last_refresh",
+ "posthog_dashboardtile"."refreshing",
+ "posthog_dashboardtile"."refresh_attempt",
+ "posthog_dashboardtile"."filters_overrides",
+ "posthog_dashboardtile"."show_description",
+ "posthog_dashboardtile"."transparent_background",
+ "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" = 99999)
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.104
+ '''
+ SELECT "posthog_dashboardtile"."id",
+ "posthog_dashboardtile"."dashboard_id",
+ "posthog_dashboardtile"."insight_id",
+ "posthog_dashboardtile"."text_id",
+ "posthog_dashboardtile"."button_tile_id",
+ "posthog_dashboardtile"."widget_id",
+ "posthog_dashboardtile"."team_id",
+ "posthog_dashboardtile"."layouts",
+ "posthog_dashboardtile"."color",
+ "posthog_dashboardtile"."filters_hash",
+ "posthog_dashboardtile"."last_refresh",
+ "posthog_dashboardtile"."refreshing",
+ "posthog_dashboardtile"."refresh_attempt",
+ "posthog_dashboardtile"."filters_overrides",
+ "posthog_dashboardtile"."show_description",
+ "posthog_dashboardtile"."transparent_background",
+ "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" = 99999)
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.105
+ '''
+ SELECT "posthog_insightvariable"."created_by_id",
+ "posthog_insightvariable"."created_at",
+ "posthog_insightvariable"."updated_at",
"posthog_insightvariable"."id",
"posthog_insightvariable"."team_id",
"posthog_insightvariable"."name",
@@ -4030,7 +4228,7 @@
WHERE "posthog_insightvariable"."team_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.103
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.106
'''
SELECT "posthog_dashboardtile"."dashboard_id" AS "dashboard_id"
FROM "posthog_dashboardtile"
@@ -4041,7 +4239,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.104
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.107
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -4074,7 +4272,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.105
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.108
'''
SELECT "posthog_tag"."name" AS "tag__name"
FROM "posthog_taggeditem"
@@ -4082,7 +4280,7 @@
WHERE "posthog_taggeditem"."insight_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.106
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.109
'''
SELECT "posthog_user"."id",
"posthog_user"."password",
@@ -4128,7 +4326,19 @@
AND "posthog_user"."id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.107
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.11
+ '''
+ SELECT COUNT(*) AS "__count"
+ 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"."dashboard_id" = 99999
+ AND NOT ("posthog_dashboardtile"."insight_id" IS NULL))
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.110
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -4173,7 +4383,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.108
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.111
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -4314,7 +4524,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.109
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.112
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -4368,19 +4578,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.11
- '''
- SELECT COUNT(*) AS "__count"
- 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"."dashboard_id" = 99999
- AND NOT ("posthog_dashboardtile"."insight_id" IS NULL))
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.110
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.113
'''
SELECT "ee_accesscontrol"."id",
"ee_accesscontrol"."team_id",
@@ -4405,7 +4603,7 @@
AND "ee_accesscontrol"."team_id" = 99999))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.111
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.114
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -4457,7 +4655,7 @@
WHERE "posthog_organizationmembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.112
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.115
'''
SELECT "ee_accesscontrol"."team_id" AS "team_id",
"ee_accesscontrol"."resource_id" AS "resource_id",
@@ -4470,7 +4668,7 @@
AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.113
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.116
'''
SELECT "ee_role"."organization_id" AS "role__organization_id",
"ee_rolemembership"."role_id" AS "role_id"
@@ -4479,7 +4677,7 @@
WHERE "ee_rolemembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.114
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.117
'''
SELECT "posthog_dashboard"."id" AS "id"
FROM "posthog_dashboard"
@@ -4499,10 +4697,23 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.115
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.118
'''
- SELECT COUNT(*) AS "__count"
- FROM "posthog_dashboardtile"
+ SELECT "posthog_dashboard"."id" AS "id",
+ "posthog_dashboard"."name" AS "name"
+ FROM "posthog_dashboard"
+ WHERE (NOT ("posthog_dashboard"."deleted")
+ AND "posthog_dashboard"."id" IN (1,
+ 2,
+ 3,
+ 4,
+ 5 /* ... */))
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.119
+ '''
+ SELECT COUNT(*) AS "__count"
+ 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)
@@ -4512,7 +4723,26 @@
AND "posthog_dashboardtile"."deleted" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.116
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.12
+ '''
+ SELECT "posthog_sharingconfiguration"."id",
+ "posthog_sharingconfiguration"."team_id",
+ "posthog_sharingconfiguration"."dashboard_id",
+ "posthog_sharingconfiguration"."insight_id",
+ "posthog_sharingconfiguration"."recording_id",
+ "posthog_sharingconfiguration"."notebook_id",
+ "posthog_sharingconfiguration"."interviewee_context_id",
+ "posthog_sharingconfiguration"."created_at",
+ "posthog_sharingconfiguration"."enabled",
+ "posthog_sharingconfiguration"."access_token",
+ "posthog_sharingconfiguration"."expires_at",
+ "posthog_sharingconfiguration"."settings",
+ "posthog_sharingconfiguration"."password_required"
+ FROM "posthog_sharingconfiguration"
+ WHERE "posthog_sharingconfiguration"."dashboard_id" = 99999
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.120
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -4545,7 +4775,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.117
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.121
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -4647,7 +4877,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.118
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.122
'''
SELECT "posthog_filesystem"."team_id",
"posthog_filesystem"."id",
@@ -4672,7 +4902,7 @@
AND "posthog_filesystem"."shortcut" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.119
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.123
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -4717,26 +4947,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.12
- '''
- SELECT "posthog_sharingconfiguration"."id",
- "posthog_sharingconfiguration"."team_id",
- "posthog_sharingconfiguration"."dashboard_id",
- "posthog_sharingconfiguration"."insight_id",
- "posthog_sharingconfiguration"."recording_id",
- "posthog_sharingconfiguration"."notebook_id",
- "posthog_sharingconfiguration"."interviewee_context_id",
- "posthog_sharingconfiguration"."created_at",
- "posthog_sharingconfiguration"."enabled",
- "posthog_sharingconfiguration"."access_token",
- "posthog_sharingconfiguration"."expires_at",
- "posthog_sharingconfiguration"."settings",
- "posthog_sharingconfiguration"."password_required"
- FROM "posthog_sharingconfiguration"
- WHERE "posthog_sharingconfiguration"."dashboard_id" = 99999
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.120
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.124
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -4838,7 +5049,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.121
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.125
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -4865,7 +5076,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.122
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.126
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -4892,7 +5103,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.123
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.127
'''
SELECT "posthog_insightvariable"."created_by_id",
"posthog_insightvariable"."created_at",
@@ -4911,7 +5122,7 @@
WHERE "posthog_insightvariable"."team_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.124
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.128
'''
SELECT "posthog_dashboardtile"."dashboard_id" AS "dashboard_id"
FROM "posthog_dashboardtile"
@@ -4922,7 +5133,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.125
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.129
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -4955,7 +5166,14 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.126
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.13
+ '''
+ SELECT COUNT(*) AS "__count"
+ FROM "posthog_taggeditem"
+ WHERE "posthog_taggeditem"."dashboard_id" = 99999
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.130
'''
SELECT "posthog_tag"."name" AS "tag__name"
FROM "posthog_taggeditem"
@@ -4963,7 +5181,7 @@
WHERE "posthog_taggeditem"."insight_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.127
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.131
'''
SELECT "posthog_user"."id",
"posthog_user"."password",
@@ -5009,7 +5227,7 @@
AND "posthog_user"."id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.128
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.132
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -5054,7 +5272,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.129
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.133
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -5195,14 +5413,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.13
- '''
- SELECT COUNT(*) AS "__count"
- FROM "posthog_taggeditem"
- WHERE "posthog_taggeditem"."dashboard_id" = 99999
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.130
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.134
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -5256,7 +5467,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.131
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.135
'''
SELECT "ee_accesscontrol"."id",
"ee_accesscontrol"."team_id",
@@ -5281,7 +5492,7 @@
AND "ee_accesscontrol"."team_id" = 99999))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.132
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.136
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -5333,7 +5544,7 @@
WHERE "posthog_organizationmembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.133
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.137
'''
SELECT "ee_accesscontrol"."team_id" AS "team_id",
"ee_accesscontrol"."resource_id" AS "resource_id",
@@ -5346,7 +5557,7 @@
AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.134
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.138
'''
SELECT "ee_role"."organization_id" AS "role__organization_id",
"ee_rolemembership"."role_id" AS "role_id"
@@ -5355,7 +5566,7 @@
WHERE "ee_rolemembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.135
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.139
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -5458,7 +5669,23 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.136
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.14
+ '''
+ SELECT "posthog_filesystem"."id" AS "id",
+ "posthog_filesystem"."path" AS "path"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'dashboard'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.140
'''
SELECT "posthog_sharingconfiguration"."id",
"posthog_sharingconfiguration"."team_id",
@@ -5481,7 +5708,7 @@
5 /* ... */)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.137
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.141
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -5844,7 +6071,7 @@
ORDER BY "posthog_dashboarditem"."order" ASC
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.138
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.142
'''
SELECT ("posthog_dashboardtile"."insight_id") AS "_prefetch_related_val_insight_id",
"posthog_dashboard"."id",
@@ -5886,7 +6113,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.139
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.143
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -5917,23 +6144,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.14
- '''
- SELECT "posthog_filesystem"."id" AS "id",
- "posthog_filesystem"."path" AS "path"
- FROM "posthog_filesystem"
- WHERE (("posthog_filesystem"."surface" IS NULL
- OR "posthog_filesystem"."surface" = 'web')
- AND "posthog_filesystem"."ref" = '0001'
- AND "posthog_filesystem"."team_id" = 99999
- AND "posthog_filesystem"."type" = 'dashboard'
- AND NOT ("posthog_filesystem"."shortcut"
- AND "posthog_filesystem"."shortcut" IS NOT NULL))
- ORDER BY 1 ASC
- LIMIT 1
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.140
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.144
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -5962,7 +6173,7 @@
2)/* ... */)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.141
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.145
'''
SELECT "posthog_taggeditem"."id",
"posthog_taggeditem"."tag_id",
@@ -5989,7 +6200,7 @@
5 /* ... */)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.142
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.146
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -6091,7 +6302,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.143
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.147
'''
SELECT "posthog_filesystem"."team_id",
"posthog_filesystem"."id",
@@ -6116,7 +6327,7 @@
AND "posthog_filesystem"."shortcut" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.144
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.148
'''
SELECT "posthog_filesystemshortcut"."id",
"posthog_filesystemshortcut"."team_id",
@@ -6139,7 +6350,7 @@
AND "posthog_filesystemshortcut"."href" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.145
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.149
'''
SELECT "posthog_insightvariable"."created_by_id",
"posthog_insightvariable"."created_at",
@@ -6158,7 +6369,23 @@
WHERE "posthog_insightvariable"."team_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.146
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.15
+ '''
+ SELECT "posthog_filesystem"."id" AS "id",
+ "posthog_filesystem"."path" AS "path"
+ FROM "posthog_filesystem"
+ WHERE (("posthog_filesystem"."surface" IS NULL
+ OR "posthog_filesystem"."surface" = 'web')
+ AND "posthog_filesystem"."ref" = '0001'
+ AND "posthog_filesystem"."team_id" = 99999
+ AND "posthog_filesystem"."type" = 'dashboard'
+ AND NOT ("posthog_filesystem"."shortcut"
+ AND "posthog_filesystem"."shortcut" IS NOT NULL))
+ ORDER BY 1 ASC
+ LIMIT 1
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.150
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -6522,7 +6749,7 @@
ORDER BY "posthog_dashboarditem"."order" ASC
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.147
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.151
'''
SELECT ("posthog_dashboardtile"."insight_id") AS "_prefetch_related_val_insight_id",
"posthog_dashboard"."id",
@@ -6564,7 +6791,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.148
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.152
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -6595,7 +6822,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.149
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.153
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -6624,23 +6851,7 @@
2)/* ... */)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.15
- '''
- SELECT "posthog_filesystem"."id" AS "id",
- "posthog_filesystem"."path" AS "path"
- FROM "posthog_filesystem"
- WHERE (("posthog_filesystem"."surface" IS NULL
- OR "posthog_filesystem"."surface" = 'web')
- AND "posthog_filesystem"."ref" = '0001'
- AND "posthog_filesystem"."team_id" = 99999
- AND "posthog_filesystem"."type" = 'dashboard'
- AND NOT ("posthog_filesystem"."shortcut"
- AND "posthog_filesystem"."shortcut" IS NOT NULL))
- ORDER BY 1 ASC
- LIMIT 1
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.150
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.154
'''
SELECT "posthog_taggeditem"."id",
"posthog_taggeditem"."tag_id",
@@ -6667,7 +6878,7 @@
5 /* ... */)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.151
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.155
'''
SELECT "posthog_alertconfiguration"."created_by_id",
"posthog_alertconfiguration"."created_at",
@@ -6748,7 +6959,7 @@
5 /* ... */)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.152
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.156
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -8897,6 +9108,19 @@
'''
# ---
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.51
+ '''
+ SELECT "posthog_dashboard"."id" AS "id",
+ "posthog_dashboard"."name" AS "name"
+ FROM "posthog_dashboard"
+ WHERE (NOT ("posthog_dashboard"."deleted")
+ AND "posthog_dashboard"."id" IN (1,
+ 2,
+ 3,
+ 4,
+ 5 /* ... */))
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.52
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_dashboardtile"
@@ -8909,7 +9133,7 @@
AND "posthog_dashboardtile"."deleted" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.52
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.53
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_dashboardtile"
@@ -8922,7 +9146,7 @@
AND "posthog_dashboardtile"."deleted" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.53
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.54
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -8955,7 +9179,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.54
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.55
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -9057,7 +9281,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.55
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.56
'''
SELECT "posthog_filesystem"."team_id",
"posthog_filesystem"."id",
@@ -9082,7 +9306,7 @@
AND "posthog_filesystem"."shortcut" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.56
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.57
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -9127,7 +9351,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.57
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.58
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -9229,7 +9453,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.58
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.59
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -9256,7 +9480,20 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.59
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.6
+ '''
+ SELECT "ee_accesscontrol"."team_id" AS "team_id",
+ "ee_accesscontrol"."resource_id" AS "resource_id",
+ "ee_accesscontrol"."organization_member_id" AS "organization_member_id",
+ "ee_accesscontrol"."role_id" AS "role_id",
+ "ee_accesscontrol"."access_level" AS "access_level"
+ FROM "ee_accesscontrol"
+ INNER JOIN "posthog_team" ON ("ee_accesscontrol"."team_id" = "posthog_team"."id")
+ WHERE ("ee_accesscontrol"."resource" = 'project'
+ AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.60
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -9283,20 +9520,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.6
- '''
- SELECT "ee_accesscontrol"."team_id" AS "team_id",
- "ee_accesscontrol"."resource_id" AS "resource_id",
- "ee_accesscontrol"."organization_member_id" AS "organization_member_id",
- "ee_accesscontrol"."role_id" AS "role_id",
- "ee_accesscontrol"."access_level" AS "access_level"
- FROM "ee_accesscontrol"
- INNER JOIN "posthog_team" ON ("ee_accesscontrol"."team_id" = "posthog_team"."id")
- WHERE ("ee_accesscontrol"."resource" = 'project'
- AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.60
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.61
'''
SELECT "posthog_insightvariable"."created_by_id",
"posthog_insightvariable"."created_at",
@@ -9315,7 +9539,7 @@
WHERE "posthog_insightvariable"."team_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.61
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.62
'''
SELECT "posthog_dashboardtile"."dashboard_id" AS "dashboard_id"
FROM "posthog_dashboardtile"
@@ -9326,7 +9550,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.62
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.63
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -9359,7 +9583,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.63
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.64
'''
SELECT "posthog_tag"."name" AS "tag__name"
FROM "posthog_taggeditem"
@@ -9367,7 +9591,7 @@
WHERE "posthog_taggeditem"."insight_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.64
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.65
'''
SELECT "posthog_user"."id",
"posthog_user"."password",
@@ -9413,7 +9637,7 @@
AND "posthog_user"."id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.65
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.66
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -9458,7 +9682,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.66
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.67
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -9599,7 +9823,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.67
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.68
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -9653,7 +9877,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.68
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.69
'''
SELECT "ee_accesscontrol"."id",
"ee_accesscontrol"."team_id",
@@ -9678,7 +9902,16 @@
AND "ee_accesscontrol"."team_id" = 99999))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.69
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.7
+ '''
+ SELECT "ee_role"."organization_id" AS "role__organization_id",
+ "ee_rolemembership"."role_id" AS "role_id"
+ FROM "ee_rolemembership"
+ INNER JOIN "ee_role" ON ("ee_rolemembership"."role_id" = "ee_role"."id")
+ WHERE "ee_rolemembership"."user_id" = 99999
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.70
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -9730,16 +9963,7 @@
WHERE "posthog_organizationmembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.7
- '''
- SELECT "ee_role"."organization_id" AS "role__organization_id",
- "ee_rolemembership"."role_id" AS "role_id"
- FROM "ee_rolemembership"
- INNER JOIN "ee_role" ON ("ee_rolemembership"."role_id" = "ee_role"."id")
- WHERE "ee_rolemembership"."user_id" = 99999
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.70
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.71
'''
SELECT "ee_accesscontrol"."team_id" AS "team_id",
"ee_accesscontrol"."resource_id" AS "resource_id",
@@ -9752,7 +9976,7 @@
AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.71
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.72
'''
SELECT "ee_role"."organization_id" AS "role__organization_id",
"ee_rolemembership"."role_id" AS "role_id"
@@ -9761,7 +9985,7 @@
WHERE "ee_rolemembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.72
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.73
'''
SELECT "posthog_dashboard"."id" AS "id"
FROM "posthog_dashboard"
@@ -9781,7 +10005,20 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.73
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.74
+ '''
+ SELECT "posthog_dashboard"."id" AS "id",
+ "posthog_dashboard"."name" AS "name"
+ FROM "posthog_dashboard"
+ WHERE (NOT ("posthog_dashboard"."deleted")
+ AND "posthog_dashboard"."id" IN (1,
+ 2,
+ 3,
+ 4,
+ 5 /* ... */))
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.75
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_dashboardtile"
@@ -9794,7 +10031,7 @@
AND "posthog_dashboardtile"."deleted" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.74
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.76
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -9827,7 +10064,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.75
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.77
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -9929,7 +10166,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.76
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.78
'''
SELECT "posthog_filesystem"."team_id",
"posthog_filesystem"."id",
@@ -9954,7 +10191,7 @@
AND "posthog_filesystem"."shortcut" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.77
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.79
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -9999,7 +10236,23 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.78
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.8
+ '''
+ SELECT COUNT(*) AS "__count"
+ FROM "posthog_dashboard"
+ INNER JOIN "posthog_team" ON ("posthog_dashboard"."team_id" = "posthog_team"."id")
+ WHERE (NOT ("posthog_dashboard"."deleted")
+ AND ("posthog_dashboard"."team_id" =
+ (SELECT U0."parent_team_id" AS "parent_team_id"
+ FROM "posthog_team" U0
+ WHERE U0."id" = 99999
+ LIMIT 1)
+ OR ("posthog_team"."parent_team_id" IS NULL
+ AND "posthog_dashboard"."team_id" = 99999))
+ AND NOT "posthog_dashboard"."deleted")
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.80
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -10101,7 +10354,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.79
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.81
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -10128,23 +10381,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.8
- '''
- SELECT COUNT(*) AS "__count"
- FROM "posthog_dashboard"
- INNER JOIN "posthog_team" ON ("posthog_dashboard"."team_id" = "posthog_team"."id")
- WHERE (NOT ("posthog_dashboard"."deleted")
- AND ("posthog_dashboard"."team_id" =
- (SELECT U0."parent_team_id" AS "parent_team_id"
- FROM "posthog_team" U0
- WHERE U0."id" = 99999
- LIMIT 1)
- OR ("posthog_team"."parent_team_id" IS NULL
- AND "posthog_dashboard"."team_id" = 99999))
- AND NOT "posthog_dashboard"."deleted")
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.80
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.82
'''
SELECT "posthog_dashboardtile"."id",
"posthog_dashboardtile"."dashboard_id",
@@ -10171,7 +10408,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.81
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.83
'''
SELECT "posthog_insightvariable"."created_by_id",
"posthog_insightvariable"."created_at",
@@ -10190,7 +10427,7 @@
WHERE "posthog_insightvariable"."team_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.82
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.84
'''
SELECT "posthog_dashboardtile"."dashboard_id" AS "dashboard_id"
FROM "posthog_dashboardtile"
@@ -10201,7 +10438,7 @@
AND "posthog_dashboardtile"."insight_id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.83
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.85
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -10234,7 +10471,7 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.84
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.86
'''
SELECT "posthog_tag"."name" AS "tag__name"
FROM "posthog_taggeditem"
@@ -10242,7 +10479,7 @@
WHERE "posthog_taggeditem"."insight_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.85
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.87
'''
SELECT "posthog_user"."id",
"posthog_user"."password",
@@ -10288,7 +10525,7 @@
AND "posthog_user"."id" = 99999)
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.86
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.88
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -10333,7 +10570,7 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.87
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.89
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -10474,85 +10711,6 @@
LIMIT 21
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.88
- '''
- SELECT "posthog_organizationmembership"."id",
- "posthog_organizationmembership"."organization_id",
- "posthog_organizationmembership"."user_id",
- "posthog_organizationmembership"."level",
- "posthog_organizationmembership"."joined_at",
- "posthog_organizationmembership"."updated_at",
- "posthog_organizationmembership"."invited_by_id",
- "posthog_organization"."id",
- "posthog_organization"."name",
- "posthog_organization"."slug",
- "posthog_organization"."logo_media_id",
- "posthog_organization"."created_at",
- "posthog_organization"."updated_at",
- "posthog_organization"."is_active",
- "posthog_organization"."is_not_active_reason",
- "posthog_organization"."session_cookie_age",
- "posthog_organization"."is_member_join_email_enabled",
- "posthog_organization"."is_ai_data_processing_approved",
- "posthog_organization"."is_ai_training_opted_in",
- "posthog_organization"."is_ai_training_locked",
- "posthog_organization"."is_ai_training_cta_shown",
- "posthog_organization"."enforce_2fa",
- "posthog_organization"."enforce_verified_domains",
- "posthog_organization"."members_can_invite",
- "posthog_organization"."members_can_create_projects",
- "posthog_organization"."members_can_use_personal_api_keys",
- "posthog_organization"."members_can_see_org_members",
- "posthog_organization"."allow_publicly_shared_resources",
- "posthog_organization"."default_role_id",
- "posthog_organization"."plugins_access_level",
- "posthog_organization"."for_internal_metrics",
- "posthog_organization"."default_experiment_stats_method",
- "posthog_organization"."default_anonymize_ips",
- "posthog_organization"."is_hipaa",
- "posthog_organization"."is_pending_deletion",
- "posthog_organization"."customer_id",
- "posthog_organization"."available_product_features",
- "posthog_organization"."usage",
- "posthog_organization"."never_drop_data",
- "posthog_organization"."customer_trust_scores",
- "posthog_organization"."has_active_subscription",
- "posthog_organization"."setup_section_2_completed",
- "posthog_organization"."personalization",
- "posthog_organization"."domain_whitelist",
- "posthog_organization"."is_platform"
- FROM "posthog_organizationmembership"
- INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
- WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
- AND "posthog_organizationmembership"."user_id" = 99999)
- LIMIT 21
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.89
- '''
- SELECT "ee_accesscontrol"."id",
- "ee_accesscontrol"."team_id",
- "ee_accesscontrol"."access_level",
- "ee_accesscontrol"."resource",
- "ee_accesscontrol"."resource_id",
- "ee_accesscontrol"."organization_member_id",
- "ee_accesscontrol"."role_id",
- "ee_accesscontrol"."created_by_id",
- "ee_accesscontrol"."created_at",
- "ee_accesscontrol"."updated_at",
- "posthog_team"."organization_id" AS "_team_organization_id"
- FROM "ee_accesscontrol"
- INNER JOIN "posthog_team" ON ("ee_accesscontrol"."team_id" = "posthog_team"."id")
- LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id")
- WHERE (("ee_accesscontrol"."organization_member_id" IS NULL
- AND "ee_accesscontrol"."role_id" IS NULL
- AND "ee_accesscontrol"."team_id" = 99999)
- OR ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
- AND "posthog_organizationmembership"."user_id" = 99999
- AND "ee_accesscontrol"."role_id" IS NULL
- AND "ee_accesscontrol"."team_id" = 99999))
- '''
-# ---
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.9
'''
SELECT "posthog_team"."id",
@@ -10704,10 +10862,89 @@
"posthog_organization"."is_platform"
FROM "posthog_organizationmembership"
INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
- WHERE "posthog_organizationmembership"."user_id" = 99999
+ WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
+ AND "posthog_organizationmembership"."user_id" = 99999)
+ LIMIT 21
'''
# ---
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.91
+ '''
+ SELECT "ee_accesscontrol"."id",
+ "ee_accesscontrol"."team_id",
+ "ee_accesscontrol"."access_level",
+ "ee_accesscontrol"."resource",
+ "ee_accesscontrol"."resource_id",
+ "ee_accesscontrol"."organization_member_id",
+ "ee_accesscontrol"."role_id",
+ "ee_accesscontrol"."created_by_id",
+ "ee_accesscontrol"."created_at",
+ "ee_accesscontrol"."updated_at",
+ "posthog_team"."organization_id" AS "_team_organization_id"
+ FROM "ee_accesscontrol"
+ INNER JOIN "posthog_team" ON ("ee_accesscontrol"."team_id" = "posthog_team"."id")
+ LEFT OUTER JOIN "posthog_organizationmembership" ON ("ee_accesscontrol"."organization_member_id" = "posthog_organizationmembership"."id")
+ WHERE (("ee_accesscontrol"."organization_member_id" IS NULL
+ AND "ee_accesscontrol"."role_id" IS NULL
+ AND "ee_accesscontrol"."team_id" = 99999)
+ OR ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
+ AND "posthog_organizationmembership"."user_id" = 99999
+ AND "ee_accesscontrol"."role_id" IS NULL
+ AND "ee_accesscontrol"."team_id" = 99999))
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.92
+ '''
+ SELECT "posthog_organizationmembership"."id",
+ "posthog_organizationmembership"."organization_id",
+ "posthog_organizationmembership"."user_id",
+ "posthog_organizationmembership"."level",
+ "posthog_organizationmembership"."joined_at",
+ "posthog_organizationmembership"."updated_at",
+ "posthog_organizationmembership"."invited_by_id",
+ "posthog_organization"."id",
+ "posthog_organization"."name",
+ "posthog_organization"."slug",
+ "posthog_organization"."logo_media_id",
+ "posthog_organization"."created_at",
+ "posthog_organization"."updated_at",
+ "posthog_organization"."is_active",
+ "posthog_organization"."is_not_active_reason",
+ "posthog_organization"."session_cookie_age",
+ "posthog_organization"."is_member_join_email_enabled",
+ "posthog_organization"."is_ai_data_processing_approved",
+ "posthog_organization"."is_ai_training_opted_in",
+ "posthog_organization"."is_ai_training_locked",
+ "posthog_organization"."is_ai_training_cta_shown",
+ "posthog_organization"."enforce_2fa",
+ "posthog_organization"."enforce_verified_domains",
+ "posthog_organization"."members_can_invite",
+ "posthog_organization"."members_can_create_projects",
+ "posthog_organization"."members_can_use_personal_api_keys",
+ "posthog_organization"."members_can_see_org_members",
+ "posthog_organization"."allow_publicly_shared_resources",
+ "posthog_organization"."default_role_id",
+ "posthog_organization"."plugins_access_level",
+ "posthog_organization"."for_internal_metrics",
+ "posthog_organization"."default_experiment_stats_method",
+ "posthog_organization"."default_anonymize_ips",
+ "posthog_organization"."is_hipaa",
+ "posthog_organization"."is_pending_deletion",
+ "posthog_organization"."customer_id",
+ "posthog_organization"."available_product_features",
+ "posthog_organization"."usage",
+ "posthog_organization"."never_drop_data",
+ "posthog_organization"."customer_trust_scores",
+ "posthog_organization"."has_active_subscription",
+ "posthog_organization"."setup_section_2_completed",
+ "posthog_organization"."personalization",
+ "posthog_organization"."domain_whitelist",
+ "posthog_organization"."is_platform"
+ FROM "posthog_organizationmembership"
+ INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id")
+ WHERE "posthog_organizationmembership"."user_id" = 99999
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.93
'''
SELECT "ee_accesscontrol"."team_id" AS "team_id",
"ee_accesscontrol"."resource_id" AS "resource_id",
@@ -10720,7 +10957,7 @@
AND "posthog_team"."organization_id" IN ('00000000-0000-0000-0000-000000000000'::uuid))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.92
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.94
'''
SELECT "ee_role"."organization_id" AS "role__organization_id",
"ee_rolemembership"."role_id" AS "role_id"
@@ -10729,7 +10966,7 @@
WHERE "ee_rolemembership"."user_id" = 99999
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.93
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.95
'''
SELECT "posthog_dashboard"."id" AS "id"
FROM "posthog_dashboard"
@@ -10749,7 +10986,20 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.94
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.96
+ '''
+ SELECT "posthog_dashboard"."id" AS "id",
+ "posthog_dashboard"."name" AS "name"
+ FROM "posthog_dashboard"
+ WHERE (NOT ("posthog_dashboard"."deleted")
+ AND "posthog_dashboard"."id" IN (1,
+ 2,
+ 3,
+ 4,
+ 5 /* ... */))
+ '''
+# ---
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.97
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_dashboardtile"
@@ -10762,7 +11012,7 @@
AND "posthog_dashboardtile"."deleted" IS NOT NULL))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.95
+# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.98
'''
SELECT "posthog_dashboard"."id",
"posthog_dashboard"."name",
@@ -10795,178 +11045,6 @@
5 /* ... */))
'''
# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.96
- '''
- SELECT "posthog_team"."id",
- "posthog_team"."uuid",
- "posthog_team"."organization_id",
- "posthog_team"."parent_team_id",
- "posthog_team"."project_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"."onboarding_tasks",
- "posthog_team"."ingested_event",
- "posthog_team"."ingested_production_event",
- "posthog_team"."ingested_production_event_last_checked_at",
- "posthog_team"."person_processing_opt_out",
- "posthog_team"."secret_api_token",
- "posthog_team"."secret_api_token_backup",
- "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"."session_recording_masking_config",
- "posthog_team"."session_recording_url_trigger_config",
- "posthog_team"."session_recording_url_blocklist_config",
- "posthog_team"."session_recording_event_trigger_config",
- "posthog_team"."session_recording_trigger_match_type_config",
- "posthog_team"."session_recording_trigger_groups",
- "posthog_team"."session_replay_config",
- "posthog_team"."session_recording_retention_period",
- "posthog_team"."event_retention_months",
- "posthog_team"."conversations_enabled",
- "posthog_team"."conversations_settings",
- "posthog_team"."proactive_tasks_enabled",
- "posthog_team"."survey_config",
- "posthog_team"."surveys_opt_in",
- "posthog_team"."product_tours_opt_in",
- "posthog_team"."capture_console_log_opt_in",
- "posthog_team"."capture_performance_opt_in",
- "posthog_team"."capture_dead_clicks",
- "posthog_team"."autocapture_opt_out",
- "posthog_team"."autocapture_web_vitals_opt_in",
- "posthog_team"."autocapture_web_vitals_allowed_metrics",
- "posthog_team"."autocapture_exceptions_opt_in",
- "posthog_team"."autocapture_exceptions_errors_to_ignore",
- "posthog_team"."logs_settings",
- "posthog_team"."llm_gateway_enabled_at",
- "posthog_team"."llm_gateway_revoked_at",
- "posthog_team"."llm_gateway_overspend_allowance_usd",
- "posthog_team"."heatmaps_opt_in",
- "posthog_team"."receive_org_level_activity_logs",
- "posthog_team"."web_analytics_pre_aggregated_tables_enabled",
- "posthog_team"."web_analytics_pre_aggregated_tables_version",
- "posthog_team"."flags_persistence_default",
- "posthog_team"."feature_flag_confirmation_enabled",
- "posthog_team"."feature_flag_confirmation_message",
- "posthog_team"."default_evaluation_environments_enabled",
- "posthog_team"."require_evaluation_environment_tags",
- "posthog_team"."default_evaluation_contexts_enabled",
- "posthog_team"."require_evaluation_contexts",
- "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"."human_friendly_comparison_periods",
- "posthog_team"."cookieless_server_hash_mode",
- "posthog_team"."primary_dashboard_id",
- "posthog_team"."default_data_theme",
- "posthog_team"."extra_settings",
- "posthog_team"."modifiers",
- "posthog_team"."correlation_config",
- "posthog_team"."session_recording_retention_period_days",
- "posthog_team"."external_data_workspace_id",
- "posthog_team"."external_data_workspace_last_synced_at",
- "posthog_team"."api_query_rate_limit",
- "posthog_team"."drop_events_older_than",
- "posthog_team"."base_currency",
- "posthog_team"."experiment_recalculation_time",
- "posthog_team"."default_experiment_confidence_level",
- "posthog_team"."default_experiment_stats_method",
- "posthog_team"."business_model"
- FROM "posthog_team"
- WHERE "posthog_team"."id" = 99999
- LIMIT 21
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.97
- '''
- SELECT "posthog_filesystem"."team_id",
- "posthog_filesystem"."id",
- "posthog_filesystem"."path",
- "posthog_filesystem"."depth",
- "posthog_filesystem"."type",
- "posthog_filesystem"."ref",
- "posthog_filesystem"."href",
- "posthog_filesystem"."shortcut",
- "posthog_filesystem"."meta",
- "posthog_filesystem"."created_at",
- "posthog_filesystem"."created_by_id",
- "posthog_filesystem"."surface",
- "posthog_filesystem"."project_id"
- FROM "posthog_filesystem"
- WHERE (("posthog_filesystem"."surface" IS NULL
- OR "posthog_filesystem"."surface" = 'web')
- AND "posthog_filesystem"."ref" = '0001'
- AND "posthog_filesystem"."team_id" = 99999
- AND "posthog_filesystem"."type" = 'insight'
- AND NOT ("posthog_filesystem"."shortcut"
- AND "posthog_filesystem"."shortcut" IS NOT NULL))
- '''
-# ---
-# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.98
- '''
- SELECT "posthog_organization"."id",
- "posthog_organization"."name",
- "posthog_organization"."slug",
- "posthog_organization"."logo_media_id",
- "posthog_organization"."created_at",
- "posthog_organization"."updated_at",
- "posthog_organization"."is_active",
- "posthog_organization"."is_not_active_reason",
- "posthog_organization"."session_cookie_age",
- "posthog_organization"."is_member_join_email_enabled",
- "posthog_organization"."is_ai_data_processing_approved",
- "posthog_organization"."is_ai_training_opted_in",
- "posthog_organization"."is_ai_training_locked",
- "posthog_organization"."is_ai_training_cta_shown",
- "posthog_organization"."enforce_2fa",
- "posthog_organization"."enforce_verified_domains",
- "posthog_organization"."members_can_invite",
- "posthog_organization"."members_can_create_projects",
- "posthog_organization"."members_can_use_personal_api_keys",
- "posthog_organization"."members_can_see_org_members",
- "posthog_organization"."allow_publicly_shared_resources",
- "posthog_organization"."default_role_id",
- "posthog_organization"."plugins_access_level",
- "posthog_organization"."for_internal_metrics",
- "posthog_organization"."default_experiment_stats_method",
- "posthog_organization"."default_anonymize_ips",
- "posthog_organization"."is_hipaa",
- "posthog_organization"."is_pending_deletion",
- "posthog_organization"."customer_id",
- "posthog_organization"."available_product_features",
- "posthog_organization"."usage",
- "posthog_organization"."never_drop_data",
- "posthog_organization"."customer_trust_scores",
- "posthog_organization"."has_active_subscription",
- "posthog_organization"."setup_section_2_completed",
- "posthog_organization"."personalization",
- "posthog_organization"."domain_whitelist",
- "posthog_organization"."is_platform"
- FROM "posthog_organization"
- WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid
- LIMIT 21
- '''
-# ---
# name: TestDashboard.test_loading_individual_dashboard_does_not_prefetch_all_possible_tiles.99
'''
SELECT "posthog_team"."id",
diff --git a/products/managed_warehouse/backend/temporal/__init__.py b/products/managed_warehouse/backend/temporal/__init__.py
index 2b7d0426c1f4..df59c8ed00d3 100644
--- a/products/managed_warehouse/backend/temporal/__init__.py
+++ b/products/managed_warehouse/backend/temporal/__init__.py
@@ -20,6 +20,7 @@ from products.managed_warehouse.backend.temporal.ducklake_copy_data_modeling_wor
)
from products.managed_warehouse.backend.temporal.ducklake_register_data_imports_workflow import (
DuckLakeRegisterDataImportsWorkflow,
+ cleanup_ducklake_registration_tables_activity,
copy_and_register_ducklake_data_imports_activity,
ducklake_register_data_imports_gate_activity,
prepare_ducklake_data_imports_registration_activity,
@@ -35,6 +36,7 @@ WORKFLOWS = [
ACTIVITIES = [
cleanup_data_imports_staging_activity,
cleanup_data_modeling_staging_activity,
+ cleanup_ducklake_registration_tables_activity,
copy_data_imports_to_ducklake_activity,
copy_data_modeling_model_to_ducklake_activity,
copy_and_register_ducklake_data_imports_activity,
diff --git a/products/managed_warehouse/backend/temporal/ducklake_register_data_imports_workflow.py b/products/managed_warehouse/backend/temporal/ducklake_register_data_imports_workflow.py
index e8a9ff7fc7f4..790da6fde9cd 100644
--- a/products/managed_warehouse/backend/temporal/ducklake_register_data_imports_workflow.py
+++ b/products/managed_warehouse/backend/temporal/ducklake_register_data_imports_workflow.py
@@ -82,6 +82,7 @@ _DUCKGRES_REGISTER_WORKER_OPTIONS = "-c duckgres.worker_cpu=4 -c duckgres.worker
# the original CALL.
_REGISTER_COPY_START_TO_CLOSE = dt.timedelta(hours=4)
_SOURCE_JOB_STATE_PATCH_ID = "ducklake-register-source-job-state-2026-08"
+_CLEANUP_FINALIZER_PATCH_ID = "ducklake-register-cleanup-finalizer-2026-08"
def _register_source_job_update(
@@ -209,11 +210,21 @@ class DuckLakeRegisterDataImportsMetadata:
ducklake_table_name: str
[email protected](frozen=True)
class DuckLakeRegisterDataImportsActivityInputs:
team_id: int
job_id: str
metadata: DuckLakeRegisterDataImportsMetadata
+ # None only for histories recorded before the workflow minted the names;
+ # those fall back to activity-local names (which the workflow cannot clean up).
+ registration_table_names: RegistrationTableNames | None = None
+
+
[email protected](frozen=True)
+class DuckLakeRegisterCleanupInputs:
+ team_id: int
+ schema_name: str
+ table_names: list[str]
class _StalePreparedGenerationError(Exception):
@@ -650,7 +661,7 @@ def _register_prepared_parquet_files(
) -> int:
schema_name = inputs.metadata.ducklake_schema_name
table_name = inputs.metadata.ducklake_table_name
- registration_names = _new_registration_table_names()
+ registration_names = inputs.registration_table_names or _new_registration_table_names()
landing_uri = _generation_scoped_landing_uri(
inputs.metadata.landing_uri,
job_id=inputs.job_id,
@@ -766,34 +777,137 @@ def _register_prepared_parquet_files(
@dataclasses.dataclass(frozen=True, kw_only=True)
-class _RegistrationTableNames:
+class RegistrationTableNames:
shadow_name: str
previous_name: str
-def _new_registration_table_names() -> _RegistrationTableNames:
- attempt_token = uuid.uuid4().hex
- return _RegistrationTableNames(
+def registration_table_names_from_token(attempt_token: str) -> RegistrationTableNames:
+ return RegistrationTableNames(
shadow_name=f"__ph_register_{attempt_token}",
previous_name=f"__ph_previous_{attempt_token}",
)
+def _new_registration_table_names() -> RegistrationTableNames:
+ return registration_table_names_from_token(uuid.uuid4().hex)
+
+
+_CLEANUP_DROP_ATTEMPTS = 3
+_CLEANUP_DROP_RETRY_SECONDS = 2.0
+
+
+def _drop_registration_table(conn: psycopg.Connection, schema_name: str, table_name: str) -> None:
+ conn.execute(
+ psql.SQL("DROP TABLE IF EXISTS {}.{}").format(
+ psql.Identifier(schema_name),
+ psql.Identifier(table_name),
+ )
+ )
+
+
def _cleanup_registration_tables(conn: psycopg.Connection, schema_name: str, table_names: list[str]) -> None:
+ # Best-effort: this runs in the register `finally`, so raising here would mask
+ # the in-flight exception. A table left behind is picked up by the workflow's
+ # cleanup finalizer activity, which retries with a fresh connection.
for table_name in table_names:
+ for attempt in range(1, _CLEANUP_DROP_ATTEMPTS + 1):
+ try:
+ _drop_registration_table(conn, schema_name, table_name)
+ break
+ except Exception as error:
+ if attempt == _CLEANUP_DROP_ATTEMPTS:
+ LOGGER.error(
+ "Failed to clean up DuckLake registration table; the workflow cleanup finalizer will retry",
+ table_name=f"{schema_name}.{table_name}",
+ exc_info=True,
+ )
+ capture_exception(error)
+ else:
+ time.sleep(_CLEANUP_DROP_RETRY_SECONDS * attempt)
+
+
+# A registration attempt's tables can live at most 4h (the copy activity's
+# start_to_close) plus ~25min of finalizer retries; anything older under the
+# registration naming pattern is an orphan from a path no finalizer could reach
+# (workflow terminate, pre-patch histories, cleanup retry exhaustion). The
+# missing-snapshot rule below additionally requires every deployment's snapshot
+# retention to exceed this age, or an in-flight attempt's table could be swept.
+_SWEEP_MIN_AGE = dt.timedelta(hours=6)
+# Each drop is its own catalog commit; the batch is sized so a full sweep fits
+# comfortably inside the finalizer's start_to_close on a contended catalog.
+# Every registration run sweeps again, so a backlog drains across runs.
+_SWEEP_BATCH_LIMIT = 15
+_REGISTRATION_TABLE_REGEX = "^__ph_(register|previous)_[0-9a-f]{32}$"
+
+
+def _sweep_query(schema_name: str) -> psql.Composed:
+ # A missing snapshot row means the table's creation snapshot already expired,
+ # so it is strictly older than any age guard: treat it as stale, not unknown.
+ return psql.SQL(
+ "SELECT t.table_name "
+ "FROM __ducklake_metadata_ducklake.ducklake_table t "
+ "JOIN __ducklake_metadata_ducklake.ducklake_schema s "
+ " ON s.schema_id = t.schema_id AND s.end_snapshot IS NULL "
+ "LEFT JOIN __ducklake_metadata_ducklake.ducklake_snapshot sn "
+ " ON sn.snapshot_id = t.begin_snapshot "
+ "WHERE t.end_snapshot IS NULL "
+ " AND s.schema_name = {} "
+ " AND regexp_matches(t.table_name, {}) "
+ # DuckDB does not infer intervals from bare string literals; the
+ # explicit CAST is what makes the age guard bind at all.
+ " AND (sn.snapshot_id IS NULL OR CAST(sn.snapshot_time AS TIMESTAMPTZ) < now() - CAST({} AS INTERVAL)) "
+ "LIMIT {}"
+ ).format(
+ psql.Literal(schema_name),
+ psql.Literal(_REGISTRATION_TABLE_REGEX),
+ psql.Literal(f"{int(_SWEEP_MIN_AGE.total_seconds())} seconds"),
+ psql.Literal(_SWEEP_BATCH_LIMIT),
+ )
+
+
+def _sweep_stale_registration_tables(conn: psycopg.Connection, schema_name: str) -> list[str]:
+ rows = conn.execute(_sweep_query(schema_name)).fetchall()
+ swept: list[str] = []
+ for (table_name,) in rows:
+ _drop_registration_table(conn, schema_name, table_name)
+ swept.append(table_name)
+ return swept
+
+
+def cleanup_ducklake_registration_tables_activity(inputs: DuckLakeRegisterCleanupInputs) -> None:
+ """Drop this attempt's registration tables, however the register activity ended.
+
+ Runs as a workflow-level finalizer so a worker crash, OOM, or activity timeout
+ cannot orphan the shadow/previous tables: the workflow replays and re-schedules
+ this activity until the drops land. Attempt-scoped uuid names plus
+ ``DROP TABLE IF EXISTS`` make it idempotent and collision-free with any other
+ registration attempt. Afterwards it sweeps stale registration tables in the
+ same schema, so each run that reaches registration also disposes of orphans
+ no finalizer could reach; the age guard keeps concurrent attempts' young
+ tables safe.
+ """
+ bind_contextvars(team_id=inputs.team_id)
+ logger = LOGGER.bind(schema_name=inputs.schema_name)
+ if not settings.TEST:
+ close_old_connections()
+
+ with _connect_to_duckgres_for_team(inputs.team_id) as conn:
+ setup_duckgres_session(conn, extensions=("ducklake",))
+ for table_name in inputs.table_names:
+ _drop_registration_table(conn, inputs.schema_name, table_name)
+ logger.info("Cleaned up DuckLake registration tables", table_names=inputs.table_names)
try:
- conn.execute(
- psql.SQL("DROP TABLE IF EXISTS {}.{}").format(
- psql.Identifier(schema_name),
- psql.Identifier(table_name),
- )
- )
- except Exception:
- LOGGER.warning(
- "Failed to clean up DuckLake registration table",
- table_name=f"{schema_name}.{table_name}",
- exc_info=True,
- )
+ swept = _sweep_stale_registration_tables(conn, inputs.schema_name)
+ except Exception as error:
+ # The sweep is opportunistic: this attempt's own tables are already
+ # dropped, and the next registration in this schema sweeps again.
+ logger.warning("Stale registration table sweep failed", error=str(error))
+ capture_exception(error)
+ else:
+ if swept:
+ logger.info("Swept stale DuckLake registration tables", table_names=swept)
def _hive_partition_columns(landing_uri: str, landing_paths: list[str]) -> list[str]:
@@ -868,18 +982,55 @@ class DuckLakeRegisterDataImportsWorkflow(PostHogWorkflow):
logger.info("Prepared Parquet generation is stale; nothing to register")
return
+ # Minting the names in the workflow puts them in history, so the cleanup
+ # finalizer can drop them even when the register activity's process dies
+ # before its own finally runs and leaves the shadow/previous tables behind.
+ registration_table_names: RegistrationTableNames | None = None
+ if workflow.patched(_CLEANUP_FINALIZER_PATCH_ID):
+ registration_table_names = registration_table_names_from_token(workflow.uuid4().hex)
+
activity_inputs = DuckLakeRegisterDataImportsActivityInputs(
team_id=inputs.team_id,
job_id=inputs.job_id,
metadata=metadata,
+ registration_table_names=registration_table_names,
)
- copy_applied = await workflow.execute_activity(
- copy_and_register_ducklake_data_imports_activity,
- activity_inputs,
- start_to_close_timeout=_REGISTER_COPY_START_TO_CLOSE,
- heartbeat_timeout=dt.timedelta(minutes=2),
- retry_policy=RetryPolicy(maximum_attempts=1),
- )
+ try:
+ copy_applied = await workflow.execute_activity(
+ copy_and_register_ducklake_data_imports_activity,
+ activity_inputs,
+ start_to_close_timeout=_REGISTER_COPY_START_TO_CLOSE,
+ heartbeat_timeout=dt.timedelta(minutes=2),
+ retry_policy=RetryPolicy(maximum_attempts=1),
+ )
+ finally:
+ if registration_table_names is not None:
+ try:
+ await workflow.execute_activity(
+ cleanup_ducklake_registration_tables_activity,
+ DuckLakeRegisterCleanupInputs(
+ team_id=inputs.team_id,
+ schema_name=metadata.ducklake_schema_name,
+ table_names=[
+ registration_table_names.shadow_name,
+ registration_table_names.previous_name,
+ ],
+ ),
+ start_to_close_timeout=dt.timedelta(minutes=2),
+ # Patient on purpose: the drops are idempotent and a leaked
+ # table is permanent, so ~25 minutes of retries rides out a
+ # duckgres outage (the correlated cause of cleanup failing).
+ retry_policy=RetryPolicy(
+ maximum_attempts=10,
+ initial_interval=dt.timedelta(seconds=5),
+ backoff_coefficient=2.0,
+ maximum_interval=dt.timedelta(minutes=5),
+ ),
+ )
+ except Exception:
+ # Cleanup failure must not mask the register outcome; leftover
+ # tables are visible via the __ph_register_/__ph_previous_ naming.
+ logger.exception("DuckLake registration table cleanup failed after retries")
if not copy_applied:
status = "stale"
if track_source_job_state:
diff --git a/products/managed_warehouse/backend/tests/temporal/test_ducklake_register_data_imports_workflow.py b/products/managed_warehouse/backend/tests/temporal/test_ducklake_register_data_imports_workflow.py
index a68e28fdcb9a..00983fdf4122 100644
--- a/products/managed_warehouse/backend/tests/temporal/test_ducklake_register_data_imports_workflow.py
+++ b/products/managed_warehouse/backend/tests/temporal/test_ducklake_register_data_imports_workflow.py
@@ -1,6 +1,7 @@
import uuid
import datetime as dt
import contextlib
+import dataclasses
from collections.abc import Iterator
import pytest
@@ -611,6 +612,7 @@ def test_copy_activity_does_not_publish_a_row_count_mismatch_when_cleanup_fails(
lambda team_id: contextlib.nullcontext(conn),
)
monkeypatch.setattr(registration_module, "setup_duckgres_session", MagicMock())
+ monkeypatch.setattr(registration_module.time, "sleep", lambda _seconds: None)
heartbeater = MagicMock()
heartbeater.__enter__ = MagicMock(return_value=heartbeater)
heartbeater.__exit__ = MagicMock(return_value=False)
@@ -621,7 +623,10 @@ def test_copy_activity_does_not_publish_a_row_count_mismatch_when_cleanup_fails(
executed = [str(call.args[0]) for call in conn.execute.call_args_list]
conn.transaction.assert_not_called()
- assert sum("DROP TABLE IF EXISTS" in query and "__ph_register_" in query for query in executed) == 1
+ assert (
+ sum("DROP TABLE IF EXISTS" in query and "__ph_register_" in query for query in executed)
+ == registration_module._CLEANUP_DROP_ATTEMPTS
+ )
assert not any("RENAME TO" in query for query in executed)
@@ -683,6 +688,7 @@ def test_registration_tables_are_owned_by_one_activity_attempt(monkeypatch):
def test_unknown_publish_commit_error_survives_temporary_table_cleanup(monkeypatch):
monkeypatch.setattr(registration_module, "_prepared_generation_is_current", lambda inputs: True)
monkeypatch.setattr(registration_module, "setup_duckgres_session", MagicMock())
+ monkeypatch.setattr(registration_module.time, "sleep", lambda _seconds: None)
conn = MagicMock()
commit_error = RuntimeError("commit acknowledgement lost")
@@ -713,8 +719,14 @@ def test_unknown_publish_commit_error_survives_temporary_table_cleanup(monkeypat
assert error.value is commit_error
executed = [str(call.args[0]) for call in conn.execute.call_args_list]
assert len([query for query in executed if "RENAME TO" in query]) == 2
- assert sum("DROP TABLE IF EXISTS" in query and "__ph_register_" in query for query in executed) == 1
- assert sum("DROP TABLE IF EXISTS" in query and "__ph_previous_" in query for query in executed) == 1
+ assert (
+ sum("DROP TABLE IF EXISTS" in query and "__ph_register_" in query for query in executed)
+ == registration_module._CLEANUP_DROP_ATTEMPTS
+ )
+ assert (
+ sum("DROP TABLE IF EXISTS" in query and "__ph_previous_" in query for query in executed)
+ == registration_module._CLEANUP_DROP_ATTEMPTS
+ )
@pytest.mark.asyncio
@@ -736,9 +748,10 @@ async def test_workflow_does_not_record_duration_when_disabled(monkeypatch):
async def test_workflow_records_end_to_end_duration_after_gate(monkeypatch):
started_at = dt.datetime(2026, 7, 30, 12, 0, 0)
finished_at = started_at + dt.timedelta(minutes=7, seconds=12)
- execute_activity = AsyncMock(side_effect=[True, None, _activity_inputs().metadata, True, None])
+ execute_activity = AsyncMock(side_effect=[True, None, _activity_inputs().metadata, True, None, None])
metrics = _mock_workflow_metrics(monkeypatch)
monkeypatch.setattr(registration_module.workflow, "execute_activity", execute_activity)
+ monkeypatch.setattr(registration_module.workflow, "uuid4", MagicMock(return_value=uuid.UUID(int=7)))
monkeypatch.setattr(
registration_module.workflow,
"now",
@@ -747,6 +760,15 @@ async def test_workflow_records_end_to_end_duration_after_gate(monkeypatch):
await DuckLakeRegisterDataImportsWorkflow().run(_workflow_inputs())
+ cleanup_call = next(
+ call
+ for call in execute_activity.await_args_list
+ if call.args[0] is registration_module.cleanup_ducklake_registration_tables_activity
+ )
+ assert cleanup_call.args[1].table_names == [
+ f"__ph_register_{uuid.UUID(int=7).hex}",
+ f"__ph_previous_{uuid.UUID(int=7).hex}",
+ ]
metric_identifiers = {"team_id": 1, "schema_id": str(_workflow_inputs().schema_id)}
metrics.started_getter.assert_called_once_with(**metric_identifiers)
metrics.started.add.assert_called_once_with(1)
@@ -786,7 +808,8 @@ async def test_workflow_skips_source_job_state_for_pre_patch_history(monkeypatch
await DuckLakeRegisterDataImportsWorkflow().run(_workflow_inputs())
- patched.assert_called_once_with(registration_module._SOURCE_JOB_STATE_PATCH_ID)
+ patched.assert_any_call(registration_module._SOURCE_JOB_STATE_PATCH_ID)
+ patched.assert_any_call(registration_module._CLEANUP_FINALIZER_PATCH_ID)
assert _recorded_source_job_statuses(execute_activity) == []
metrics.finished_getter.assert_called_once_with(
team_id=1,
@@ -806,12 +829,14 @@ async def test_workflow_retries_completed_state_without_recording_failure(monkey
None,
_activity_inputs().metadata,
True,
+ None,
RuntimeError("completion write failed"),
None,
]
)
metrics = _mock_workflow_metrics(monkeypatch)
monkeypatch.setattr(registration_module.workflow, "execute_activity", execute_activity)
+ monkeypatch.setattr(registration_module.workflow, "uuid4", MagicMock(return_value=uuid.UUID(int=7)))
monkeypatch.setattr(
registration_module.workflow,
"now",
@@ -832,6 +857,179 @@ async def test_workflow_retries_completed_state_without_recording_failure(monkey
)
+async def test_workflow_cleanup_finalizer_runs_when_copy_activity_fails(monkeypatch):
+ started_at = dt.datetime(2026, 7, 30, 12, 0, 0)
+ failed_at = started_at + dt.timedelta(minutes=3)
+ execute_activity = AsyncMock(
+ side_effect=[
+ True,
+ None,
+ _activity_inputs().metadata,
+ RuntimeError("register worker died"),
+ None,
+ None,
+ ]
+ )
+ _mock_workflow_metrics(monkeypatch)
+ monkeypatch.setattr(registration_module.workflow, "execute_activity", execute_activity)
+ monkeypatch.setattr(registration_module.workflow, "uuid4", MagicMock(return_value=uuid.UUID(int=9)))
+ monkeypatch.setattr(
+ registration_module.workflow,
+ "now",
+ MagicMock(side_effect=[started_at, failed_at, failed_at]),
+ )
+
+ with pytest.raises(RuntimeError, match="register worker died"):
+ await DuckLakeRegisterDataImportsWorkflow().run(_workflow_inputs())
+
+ copy_call = next(
+ call
+ for call in execute_activity.await_args_list
+ if call.args[0] is copy_and_register_ducklake_data_imports_activity
+ )
+ cleanup_call = next(
+ call
+ for call in execute_activity.await_args_list
+ if call.args[0] is registration_module.cleanup_ducklake_registration_tables_activity
+ )
+ names = copy_call.args[1].registration_table_names
+ assert names is not None
+ assert cleanup_call.args[1].table_names == [names.shadow_name, names.previous_name]
+ assert cleanup_call.args[1].schema_name == _activity_inputs().metadata.ducklake_schema_name
+
+
+def test_cleanup_activity_drops_requested_tables_and_sweeps_stale_ones(monkeypatch):
+ stale_shadow = f"__ph_register_{uuid.UUID(int=3).hex}"
+ conn = MagicMock()
+
+ def execute(query: object) -> MagicMock:
+ if "FROM __ducklake_metadata_ducklake.ducklake_table" in str(query):
+ return MagicMock(fetchall=MagicMock(return_value=[(stale_shadow,)]))
+ return MagicMock()
+
+ conn.execute.side_effect = execute
+ monkeypatch.setattr(
+ registration_module,
+ "_connect_to_duckgres_for_team",
+ lambda team_id: contextlib.nullcontext(conn),
+ )
+ monkeypatch.setattr(registration_module, "setup_duckgres_session", MagicMock())
+
+ registration_module.cleanup_ducklake_registration_tables_activity(
+ registration_module.DuckLakeRegisterCleanupInputs(
+ team_id=1,
+ schema_name="posthog_data_imports_team_1",
+ table_names=["__ph_register_abc", "__ph_previous_abc"],
+ )
+ )
+
+ executed = [str(call.args[0]) for call in conn.execute.call_args_list]
+ assert sum("DROP TABLE IF EXISTS" in query and "__ph_register_abc" in query for query in executed) == 1
+ assert sum("DROP TABLE IF EXISTS" in query and "__ph_previous_abc" in query for query in executed) == 1
+ assert sum("DROP TABLE IF EXISTS" in query and stale_shadow in query for query in executed) == 1
+ sweep_query = next(query for query in executed if "FROM __ducklake_metadata_ducklake.ducklake_table" in query)
+ assert registration_module._REGISTRATION_TABLE_REGEX in sweep_query
+ assert "posthog_data_imports_team_1" in sweep_query
+ assert "CAST" in sweep_query and "AS INTERVAL" in sweep_query
+
+
+def test_cleanup_activity_survives_sweep_failure(monkeypatch):
+ conn = MagicMock()
+
+ def execute(query: object) -> MagicMock:
+ if "FROM __ducklake_metadata_ducklake.ducklake_table" in str(query):
+ raise RuntimeError("metadata catalog unavailable")
+ return MagicMock()
+
+ conn.execute.side_effect = execute
+ monkeypatch.setattr(
+ registration_module,
+ "_connect_to_duckgres_for_team",
+ lambda team_id: contextlib.nullcontext(conn),
+ )
+ monkeypatch.setattr(registration_module, "setup_duckgres_session", MagicMock())
+ monkeypatch.setattr(registration_module, "capture_exception", MagicMock())
+
+ registration_module.cleanup_ducklake_registration_tables_activity(
+ registration_module.DuckLakeRegisterCleanupInputs(
+ team_id=1,
+ schema_name="posthog_data_imports_team_1",
+ table_names=["__ph_register_abc", "__ph_previous_abc"],
+ )
+ )
+
+ executed = [str(call.args[0]) for call in conn.execute.call_args_list]
+ assert sum("DROP TABLE IF EXISTS" in query and "__ph_register_abc" in query for query in executed) == 1
+ assert sum("DROP TABLE IF EXISTS" in query and "__ph_previous_abc" in query for query in executed) == 1
+
+
+def test_sweep_query_executes_on_duckdb_and_applies_the_guards():
+ import duckdb
+
+ conn = duckdb.connect()
+ conn.execute('CREATE SCHEMA "__ducklake_metadata_ducklake"')
+ conn.execute(
+ 'CREATE TABLE "__ducklake_metadata_ducklake".ducklake_table '
+ "(table_id BIGINT, schema_id BIGINT, table_name VARCHAR, begin_snapshot BIGINT, end_snapshot BIGINT)"
+ )
+ conn.execute(
+ 'CREATE TABLE "__ducklake_metadata_ducklake".ducklake_schema '
+ "(schema_id BIGINT, schema_name VARCHAR, end_snapshot BIGINT)"
+ )
+ conn.execute(
+ 'CREATE TABLE "__ducklake_metadata_ducklake".ducklake_snapshot (snapshot_id BIGINT, snapshot_time VARCHAR)'
+ )
+ conn.execute(
+ "INSERT INTO \"__ducklake_metadata_ducklake\".ducklake_schema VALUES (1, 'posthog_data_imports_team_1', NULL)"
+ )
+ old_shadow = f"__ph_register_{uuid.UUID(int=1).hex}"
+ young_shadow = f"__ph_register_{uuid.UUID(int=2).hex}"
+ expired_snapshot_shadow = f"__ph_previous_{uuid.UUID(int=3).hex}"
+ conn.execute(
+ 'INSERT INTO "__ducklake_metadata_ducklake".ducklake_snapshot '
+ "VALUES (10, CAST(now() - INTERVAL '2 days' AS VARCHAR)), (11, CAST(now() AS VARCHAR))"
+ )
+ conn.execute(
+ 'INSERT INTO "__ducklake_metadata_ducklake".ducklake_table VALUES '
+ f"(100, 1, '{old_shadow}', 10, NULL), "
+ f"(101, 1, '{young_shadow}', 11, NULL), "
+ f"(102, 1, '{expired_snapshot_shadow}', 9, NULL), " # snapshot row 9 does not exist
+ f"(103, 1, 'stripe_prod_customer', 10, NULL), " # non-matching name, old
+ f"(104, 1, '{old_shadow}', 10, 11)" # already dropped
+ )
+
+ rendered = registration_module._sweep_query("posthog_data_imports_team_1").as_string()
+ swept = {row[0] for row in conn.execute(rendered).fetchall()}
+
+ assert swept == {old_shadow, expired_snapshot_shadow}
+
+
+def test_register_uses_workflow_minted_names(monkeypatch):
+ monkeypatch.setattr(registration_module, "_should_publish_prepared_generation", lambda inputs: True)
+ monkeypatch.setattr(registration_module, "setup_duckgres_session", MagicMock())
+ conn = MagicMock()
+
+ def execute(query: object) -> MagicMock:
+ if "SELECT count(*) FROM" in str(query):
+ return MagicMock(fetchone=MagicMock(return_value=(10,)))
+ return MagicMock()
+
+ conn.execute.side_effect = execute
+ names = registration_module.registration_table_names_from_token("feedc0de" * 4)
+ inputs = dataclasses.replace(_activity_inputs(), registration_table_names=names)
+
+ registration_module._register_prepared_parquet_files(
+ inputs,
+ conn,
+ [f"{inputs.metadata.landing_uri}/file.parquet"],
+ )
+
+ executed = [str(call.args[0]) for call in conn.execute.call_args_list]
+ assert any("CREATE TABLE" in query and names.shadow_name in query for query in executed)
+ assert any("RENAME TO" in query and names.previous_name in query for query in executed)
+
+
@pytest.mark.asyncio
async def test_workflow_records_end_to_end_duration_on_post_gate_failure(monkeypatch):
started_at = dt.datetime(2026, 7, 30, 12, 0, 0)