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.

refactor(replay): convert frustration-signals query to HogQL (#63881)

Paul D'Ambrabc1fce459c56
diff --git a/posthog/session_recordings/synthetic_playlists.py b/posthog/session_recordings/synthetic_playlists.py
index f683f65e7832..6e12ae6f0f94 100644
--- a/posthog/session_recordings/synthetic_playlists.py
+++ b/posthog/session_recordings/synthetic_playlists.py
@@ -12,7 +12,9 @@ from django.core.cache import cache
from posthog.schema import RecordingOrder, RecordingsQuery
-from posthog.clickhouse.client import sync_execute
+from posthog.hogql import ast
+from posthog.hogql.query import execute_hogql_query
+
from posthog.clickhouse.query_tagging import Feature, Product, tag_queries
from posthog.models import Comment, Team, User
from posthog.models.sharing_configuration import SharingConfiguration
@@ -319,35 +321,35 @@ class FrustrationSignalsPlaylistSource(SyntheticPlaylistSource):
query = """
SELECT
- `$session_id` AS session_id,
+ properties.$session_id AS session_id,
countIf(event = '$rageclick') * 3
+ countIf(event = '$exception') * 2
AS frustration_score
FROM events
WHERE
- team_id = %(team_id)s
- AND event IN ('$rageclick', '$exception')
- AND timestamp >= %(date_from)s
- AND timestamp <= %(date_to)s
- AND notEmpty(`$session_id`)
- GROUP BY `$session_id`
- HAVING frustration_score > %(min_frustration_score)s
+ event IN ('$rageclick', '$exception')
+ AND timestamp >= {date_from}
+ AND timestamp <= {date_to}
+ AND notEmpty(properties.$session_id)
+ GROUP BY properties.$session_id
+ HAVING frustration_score > {min_frustration_score}
ORDER BY frustration_score DESC
LIMIT 1000
"""
tag_queries(product=Product.REPLAY, feature=Feature.QUERY, team_id=team.pk)
- result = sync_execute(
- query,
- {
- "team_id": team.pk,
- "date_from": date_from,
- "date_to": now_ts,
- "min_frustration_score": FrustrationSignalsPlaylistSource.MIN_FRUSTRATION_SCORE,
+ response = execute_hogql_query(
+ query=query,
+ team=team,
+ query_type="SessionRecordingFrustrationSignalsQuery",
+ placeholders={
+ "date_from": ast.Constant(value=date_from),
+ "date_to": ast.Constant(value=now_ts),
+ "min_frustration_score": ast.Constant(value=FrustrationSignalsPlaylistSource.MIN_FRUSTRATION_SCORE),
},
)
- session_ids = [row[0] for row in result]
+ session_ids = [row[0] for row in response.results or []]
cache.set(cache_key, session_ids, FrustrationSignalsPlaylistSource.CACHE_TTL)
return session_ids
diff --git a/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambr b/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambr
index f9931ea303f7..2ce7f0a26977 100644
--- a/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambr
+++ b/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambr
@@ -986,14 +986,193 @@
# ---
# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.28
'''
- SELECT COUNT(*)
- FROM
- (SELECT DISTINCT "ee_single_session_summary"."session_id" AS "session_id"
- FROM "ee_single_session_summary"
- WHERE "ee_single_session_summary"."team_id" = 99999) subquery
+ SELECT "posthog_datawarehousesavedquery"."created_by_id",
+ "posthog_datawarehousesavedquery"."created_at",
+ "posthog_datawarehousesavedquery"."updated_at",
+ "posthog_datawarehousesavedquery"."deleted",
+ "posthog_datawarehousesavedquery"."deleted_at",
+ "posthog_datawarehousesavedquery"."id",
+ "posthog_datawarehousesavedquery"."name",
+ "posthog_datawarehousesavedquery"."team_id",
+ "posthog_datawarehousesavedquery"."latest_error",
+ "posthog_datawarehousesavedquery"."columns",
+ "posthog_datawarehousesavedquery"."external_tables",
+ "posthog_datawarehousesavedquery"."query",
+ "posthog_datawarehousesavedquery"."status",
+ "posthog_datawarehousesavedquery"."last_run_at",
+ "posthog_datawarehousesavedquery"."sync_frequency_interval",
+ "posthog_datawarehousesavedquery"."table_id",
+ "posthog_datawarehousesavedquery"."is_materialized",
+ "posthog_datawarehousesavedquery"."deleted_name",
+ "posthog_datawarehousesavedquery"."managed_viewset_id",
+ "posthog_datawarehousesavedquery"."folder_id",
+ "posthog_datawarehousesavedquery"."origin",
+ "posthog_datawarehousesavedquery"."is_test",
+ "posthog_datawarehousesavedquery"."expires_at",
+ "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_password_reset_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"."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",
+ "posthog_datawarehousetable"."created_by_id",
+ "posthog_datawarehousetable"."created_at",
+ "posthog_datawarehousetable"."updated_at",
+ "posthog_datawarehousetable"."deleted",
+ "posthog_datawarehousetable"."deleted_at",
+ "posthog_datawarehousetable"."id",
+ "posthog_datawarehousetable"."name",
+ "posthog_datawarehousetable"."format",
+ "posthog_datawarehousetable"."team_id",
+ "posthog_datawarehousetable"."url_pattern",
+ "posthog_datawarehousetable"."queryable_folder",
+ "posthog_datawarehousetable"."credential_id",
+ "posthog_datawarehousetable"."external_data_source_id",
+ "posthog_datawarehousetable"."columns",
+ "posthog_datawarehousetable"."options",
+ "posthog_datawarehousetable"."row_count",
+ "posthog_datawarehousetable"."size_in_s3_mib",
+ "posthog_datawarehousemanagedviewset"."created_by_id",
+ "posthog_datawarehousemanagedviewset"."created_at",
+ "posthog_datawarehousemanagedviewset"."updated_at",
+ "posthog_datawarehousemanagedviewset"."id",
+ "posthog_datawarehousemanagedviewset"."team_id",
+ "posthog_datawarehousemanagedviewset"."kind"
+ FROM "posthog_datawarehousesavedquery"
+ LEFT OUTER JOIN "posthog_datawarehousemanagedviewset" ON ("posthog_datawarehousesavedquery"."managed_viewset_id" = "posthog_datawarehousemanagedviewset"."id")
+ LEFT OUTER JOIN "posthog_user" ON ("posthog_datawarehousesavedquery"."created_by_id" = "posthog_user"."id")
+ LEFT OUTER JOIN "posthog_datawarehousetable" ON ("posthog_datawarehousesavedquery"."table_id" = "posthog_datawarehousetable"."id")
+ WHERE ("posthog_datawarehousesavedquery"."team_id" = 99999
+ AND NOT ("posthog_datawarehousesavedquery"."deleted"
+ AND "posthog_datawarehousesavedquery"."deleted" IS NOT NULL)
+ AND "posthog_datawarehousesavedquery"."managed_viewset_id" IS NULL)
+ ORDER BY "posthog_datawarehousesavedquery"."name" ASC
'''
# ---
# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.29
+ '''
+ SELECT "posthog_datawarehousesavedquery"."created_by_id",
+ "posthog_datawarehousesavedquery"."created_at",
+ "posthog_datawarehousesavedquery"."updated_at",
+ "posthog_datawarehousesavedquery"."deleted",
+ "posthog_datawarehousesavedquery"."deleted_at",
+ "posthog_datawarehousesavedquery"."id",
+ "posthog_datawarehousesavedquery"."name",
+ "posthog_datawarehousesavedquery"."team_id",
+ "posthog_datawarehousesavedquery"."latest_error",
+ "posthog_datawarehousesavedquery"."columns",
+ "posthog_datawarehousesavedquery"."external_tables",
+ "posthog_datawarehousesavedquery"."query",
+ "posthog_datawarehousesavedquery"."status",
+ "posthog_datawarehousesavedquery"."last_run_at",
+ "posthog_datawarehousesavedquery"."sync_frequency_interval",
+ "posthog_datawarehousesavedquery"."table_id",
+ "posthog_datawarehousesavedquery"."is_materialized",
+ "posthog_datawarehousesavedquery"."deleted_name",
+ "posthog_datawarehousesavedquery"."managed_viewset_id",
+ "posthog_datawarehousesavedquery"."folder_id",
+ "posthog_datawarehousesavedquery"."origin",
+ "posthog_datawarehousesavedquery"."is_test",
+ "posthog_datawarehousesavedquery"."expires_at",
+ "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_password_reset_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"."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",
+ "posthog_datawarehousetable"."created_by_id",
+ "posthog_datawarehousetable"."created_at",
+ "posthog_datawarehousetable"."updated_at",
+ "posthog_datawarehousetable"."deleted",
+ "posthog_datawarehousetable"."deleted_at",
+ "posthog_datawarehousetable"."id",
+ "posthog_datawarehousetable"."name",
+ "posthog_datawarehousetable"."format",
+ "posthog_datawarehousetable"."team_id",
+ "posthog_datawarehousetable"."url_pattern",
+ "posthog_datawarehousetable"."queryable_folder",
+ "posthog_datawarehousetable"."credential_id",
+ "posthog_datawarehousetable"."external_data_source_id",
+ "posthog_datawarehousetable"."columns",
+ "posthog_datawarehousetable"."options",
+ "posthog_datawarehousetable"."row_count",
+ "posthog_datawarehousetable"."size_in_s3_mib"
+ FROM "posthog_datawarehousesavedquery"
+ LEFT OUTER JOIN "posthog_user" ON ("posthog_datawarehousesavedquery"."created_by_id" = "posthog_user"."id")
+ LEFT OUTER JOIN "posthog_datawarehousetable" ON ("posthog_datawarehousesavedquery"."table_id" = "posthog_datawarehousetable"."id")
+ WHERE ("posthog_datawarehousesavedquery"."team_id" = 99999
+ AND "posthog_datawarehousesavedquery"."origin" = 'endpoint'
+ AND NOT ("posthog_datawarehousesavedquery"."deleted"
+ AND "posthog_datawarehousesavedquery"."deleted" IS NOT NULL))
+ '''
+# ---
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.3
'''
SELECT "posthog_user"."id",
"posthog_user"."password",
@@ -1038,7 +1217,305 @@
AND "posthog_user"."id" = 99999)
'''
# ---
-# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.3
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.30
+ '''
+ SELECT "posthog_externaldatasource"."created_by_id",
+ "posthog_externaldatasource"."created_at",
+ "posthog_externaldatasource"."updated_at",
+ "posthog_externaldatasource"."deleted",
+ "posthog_externaldatasource"."deleted_at",
+ "posthog_externaldatasource"."id",
+ "posthog_externaldatasource"."source_id",
+ "posthog_externaldatasource"."connection_id",
+ "posthog_externaldatasource"."destination_id",
+ "posthog_externaldatasource"."team_id",
+ "posthog_externaldatasource"."sync_frequency",
+ "posthog_externaldatasource"."status",
+ "posthog_externaldatasource"."source_type",
+ "posthog_externaldatasource"."job_inputs",
+ "posthog_externaldatasource"."connection_metadata",
+ "posthog_externaldatasource"."are_tables_created",
+ "posthog_externaldatasource"."prefix",
+ "posthog_externaldatasource"."description",
+ "posthog_externaldatasource"."created_via",
+ "posthog_externaldatasource"."access_method",
+ "posthog_externaldatasource"."direct_query_enabled",
+ "posthog_externaldatasource"."revenue_analytics_enabled",
+ "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",
+ "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",
+ "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"
+ FROM "posthog_externaldatasource"
+ LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")
+ WHERE ("posthog_externaldatasource"."source_type" IN ('Stripe')
+ AND "posthog_externaldatasource"."team_id" = 99999
+ AND NOT ("posthog_externaldatasource"."deleted"
+ AND "posthog_externaldatasource"."deleted" IS NOT NULL))
+ '''
+# ---
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.31
+ '''
+ SELECT "posthog_datawarehousetable"."created_by_id",
+ "posthog_datawarehousetable"."created_at",
+ "posthog_datawarehousetable"."updated_at",
+ "posthog_datawarehousetable"."deleted",
+ "posthog_datawarehousetable"."deleted_at",
+ "posthog_datawarehousetable"."id",
+ "posthog_datawarehousetable"."name",
+ "posthog_datawarehousetable"."format",
+ "posthog_datawarehousetable"."team_id",
+ "posthog_datawarehousetable"."url_pattern",
+ "posthog_datawarehousetable"."queryable_folder",
+ "posthog_datawarehousetable"."credential_id",
+ "posthog_datawarehousetable"."external_data_source_id",
+ "posthog_datawarehousetable"."columns",
+ "posthog_datawarehousetable"."options",
+ "posthog_datawarehousetable"."row_count",
+ "posthog_datawarehousetable"."size_in_s3_mib",
+ "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_password_reset_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"."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_datawarehousetable"
+ LEFT OUTER JOIN "posthog_externaldatasource" ON ("posthog_datawarehousetable"."external_data_source_id" = "posthog_externaldatasource"."id")
+ LEFT OUTER JOIN "posthog_user" ON ("posthog_datawarehousetable"."created_by_id" = "posthog_user"."id")
+ WHERE ("posthog_datawarehousetable"."team_id" = 99999
+ AND NOT ("posthog_datawarehousetable"."deleted"
+ AND "posthog_datawarehousetable"."deleted" IS NOT NULL)
+ AND NOT ("posthog_externaldatasource"."deleted"
+ AND "posthog_externaldatasource"."deleted" IS NOT NULL)
+ AND NOT ("posthog_externaldatasource"."access_method" = 'direct'
+ AND "posthog_externaldatasource"."access_method" IS NOT NULL))
+ ORDER BY "posthog_datawarehousetable"."created_at" DESC
+ '''
+# ---
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.32
+ '''
+ SELECT "posthog_datawarehousejoin"."created_by_id",
+ "posthog_datawarehousejoin"."created_at",
+ "posthog_datawarehousejoin"."deleted",
+ "posthog_datawarehousejoin"."deleted_at",
+ "posthog_datawarehousejoin"."id",
+ "posthog_datawarehousejoin"."team_id",
+ "posthog_datawarehousejoin"."source_table_name",
+ "posthog_datawarehousejoin"."source_table_key",
+ "posthog_datawarehousejoin"."joining_table_name",
+ "posthog_datawarehousejoin"."joining_table_key",
+ "posthog_datawarehousejoin"."field_name",
+ "posthog_datawarehousejoin"."configuration"
+ FROM "posthog_datawarehousejoin"
+ WHERE ("posthog_datawarehousejoin"."team_id" = 99999
+ AND NOT ("posthog_datawarehousejoin"."deleted"
+ AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))
+ '''
+# ---
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.33
+ '''
+ 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"."revenue_tracking_config",
+ "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",
+ "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"."members_can_invite",
+ "posthog_organization"."members_can_create_projects",
+ "posthog_organization"."members_can_use_personal_api_keys",
+ "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"."setup_section_2_completed",
+ "posthog_organization"."personalization",
+ "posthog_organization"."domain_whitelist",
+ "posthog_organization"."is_platform"
+ FROM "posthog_team"
+ INNER JOIN "posthog_organization" ON ("posthog_team"."organization_id" = "posthog_organization"."id")
+ WHERE "posthog_team"."id" = 99999
+ ORDER BY "posthog_team"."id" ASC
+ LIMIT 1
+ '''
+# ---
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.34
+ '''
+ SELECT "posthog_propertydefinition"."id",
+ "posthog_propertydefinition"."team_id",
+ "posthog_propertydefinition"."project_id",
+ "posthog_propertydefinition"."name",
+ "posthog_propertydefinition"."is_numerical",
+ "posthog_propertydefinition"."property_type",
+ "posthog_propertydefinition"."type",
+ "posthog_propertydefinition"."group_type_index",
+ "posthog_propertydefinition"."property_type_format",
+ "posthog_propertydefinition"."volume_30_day",
+ "posthog_propertydefinition"."query_usage_30_day"
+ FROM "posthog_propertydefinition"
+ WHERE (COALESCE("posthog_propertydefinition"."project_id", "posthog_propertydefinition"."team_id") = 99999
+ AND "posthog_propertydefinition"."name" IN ('$session_id')
+ AND "posthog_propertydefinition"."type" IN (1,
+ 2,
+ 3,
+ 4,
+ 5 /* ... */))
+ '''
+# ---
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.35
+ '''
+ SELECT COUNT(*)
+ FROM
+ (SELECT DISTINCT "ee_single_session_summary"."session_id" AS "session_id"
+ FROM "ee_single_session_summary"
+ WHERE "ee_single_session_summary"."team_id" = 99999) subquery
+ '''
+# ---
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.36
'''
SELECT "posthog_user"."id",
"posthog_user"."password",
@@ -1083,7 +1560,7 @@
AND "posthog_user"."id" = 99999)
'''
# ---
-# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.30
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.37
'''
SELECT "posthog_organization"."id",
"posthog_organization"."name",
@@ -1125,7 +1602,7 @@
LIMIT 21
'''
# ---
-# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.31
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.38
'''
SELECT "posthog_team"."id",
"posthog_team"."uuid",
@@ -1264,7 +1741,7 @@
LIMIT 21
'''
# ---
-# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.32
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.39
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -1315,7 +1792,49 @@
LIMIT 21
'''
# ---
-# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.33
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.4
+ '''
+ 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"."members_can_invite",
+ "posthog_organization"."members_can_create_projects",
+ "posthog_organization"."members_can_use_personal_api_keys",
+ "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"."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: TestSessionRecordingPlaylist.test_filters_playlist_by_type.40
'''
SELECT "ee_accesscontrol"."id",
"ee_accesscontrol"."team_id",
@@ -1339,7 +1858,7 @@
AND "ee_accesscontrol"."team_id" = 99999))
'''
# ---
-# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.34
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.41
'''
SELECT "posthog_organizationmembership"."id",
"posthog_organizationmembership"."organization_id",
@@ -1388,7 +1907,7 @@
WHERE "posthog_organizationmembership"."user_id" = 99999
'''
# ---
-# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.35
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.42
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_sessionrecordingplaylist"
@@ -1399,7 +1918,7 @@
AND NOT "posthog_sessionrecordingplaylist"."deleted")
'''
# ---
-# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.36
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.43
'''
SELECT "posthog_sessionrecordingplaylist"."id",
"posthog_sessionrecordingplaylist"."short_id",
@@ -1612,7 +2131,7 @@
LIMIT 93
'''
# ---
-# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.37
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.44
'''
SELECT "posthog_sessionrecordingplaylistitem"."playlist_id" AS "playlist_id",
COUNT("posthog_sessionrecordingplaylistitem"."id") AS "c"
@@ -1629,7 +2148,7 @@
GROUP BY 1
'''
# ---
-# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.38
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.45
'''
SELECT "posthog_sessionrecordingplaylistitem"."playlist_id" AS "playlist_id",
"posthog_sessionrecordingplaylistitem"."recording_id" AS "recording_id"
@@ -1643,7 +2162,7 @@
5 /* ... */))
'''
# ---
-# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.39
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.46
'''
SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"
FROM "posthog_sessionrecordingviewed"
@@ -1652,49 +2171,7 @@
AND "posthog_sessionrecordingviewed"."session_id" IN ('00000000-0000-0000-0000-000000000000'))
'''
# ---
-# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.4
- '''
- 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"."members_can_invite",
- "posthog_organization"."members_can_create_projects",
- "posthog_organization"."members_can_use_personal_api_keys",
- "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"."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: TestSessionRecordingPlaylist.test_filters_playlist_by_type.40
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.47
'''
SELECT COUNT(*) AS "__count"
FROM "posthog_sessionrecordingviewed"
@@ -1702,7 +2179,7 @@
AND "posthog_sessionrecordingviewed"."user_id" = 99999)
'''
# ---
-# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.41
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.48
'''
SELECT COUNT(*)
FROM
@@ -1714,7 +2191,7 @@
AND NOT ("posthog_comment"."item_id" IS NULL))) subquery
'''
# ---
-# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.42
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.49
'''
SELECT COUNT(*)
FROM
@@ -1725,30 +2202,6 @@
AND NOT ("posthog_sharingconfiguration"."recording_id" IS NULL))) subquery
'''
# ---
-# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.43
- '''
- SELECT COUNT(*)
- FROM
- (SELECT DISTINCT ("posthog_exportedasset"."export_context" -> 'session_recording_id') AS "export_context__session_recording_id"
- FROM "posthog_exportedasset"
- WHERE (("posthog_exportedasset"."expires_after" >= '2025-01-01 12:00:00+00:00'::timestamptz
- OR "posthog_exportedasset"."expires_after" IS NULL)
- AND "posthog_exportedasset"."team_id" = 99999
- AND "posthog_exportedasset"."export_context" ? 'session_recording_id'
- AND NOT (("posthog_exportedasset"."export_context" -> 'session_recording_id') IS NULL)
- AND NOT (("posthog_exportedasset"."export_context" -> 'session_recording_id') = '""'::jsonb
- AND "posthog_exportedasset"."export_context" IS NOT NULL))) subquery
- '''
-# ---
-# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.44
- '''
- SELECT COUNT(*)
- FROM
- (SELECT DISTINCT "ee_single_session_summary"."session_id" AS "session_id"
- FROM "ee_single_session_summary"
- WHERE "ee_single_session_summary"."team_id" = 99999) subquery
- '''
-# ---
# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.5
'''
SELECT "posthog_team"."id",
@@ -1888,6 +2341,30 @@
LIMIT 21
'''
# ---
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.50
+ '''
+ SELECT COUNT(*)
+ FROM
+ (SELECT DISTINCT ("posthog_exportedasset"."export_context" -> 'session_recording_id') AS "export_context__session_recording_id"
+ FROM "posthog_exportedasset"
+ WHERE (("posthog_exportedasset"."expires_after" >= '2025-01-01 12:00:00+00:00'::timestamptz
+ OR "posthog_exportedasset"."expires_after" IS NULL)
+ AND "posthog_exportedasset"."team_id" = 99999
+ AND "posthog_exportedasset"."export_context" ? 'session_recording_id'
+ AND NOT (("posthog_exportedasset"."export_context" -> 'session_recording_id') IS NULL)
+ AND NOT (("posthog_exportedasset"."export_context" -> 'session_recording_id') = '""'::jsonb
+ AND "posthog_exportedasset"."export_context" IS NOT NULL))) subquery
+ '''
+# ---
+# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.51
+ '''
+ SELECT COUNT(*)
+ FROM
+ (SELECT DISTINCT "ee_single_session_summary"."session_id" AS "session_id"
+ FROM "ee_single_session_summary"
+ WHERE "ee_single_session_summary"."team_id" = 99999) subquery
+ '''
+# ---
# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.6
'''
SELECT "posthog_organizationmembership"."id",