: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(data-warehouse): describe all HogQL schema tables and columns (#66129)
Tom Owers474578f88bc7
diff --git a/posthog/hogql/database/schema/account_aggregates.py b/posthog/hogql/database/schema/account_aggregates.pyindex faebddb79e63..d02eed2882f7 100644--- a/posthog/hogql/database/schema/account_aggregates.py+++ b/posthog/hogql/database/schema/account_aggregates.py@@ -46,20 +46,28 @@ class _AccountScopedPostgresTable(PostgresTable, DANGEROUS_NoTeamIdCheckTable):_account_tagged_items: _AccountScopedPostgresTable = _AccountScopedPostgresTable(name="_account_tagged_items",postgres_table_name="posthog_taggeditem",+ description="Internal federated junction table (PostgreSQL `posthog_taggeditem`) of tag-to-account links; not for direct querying — use `system.accounts.tags`.",fields={- "id": UUIDDatabaseField(name="id"),- "tag_id": UUIDDatabaseField(name="tag_id"),- "account_id": UUIDDatabaseField(name="account_id", nullable=True),+ "id": UUIDDatabaseField(name="id", description="Primary key of the tagged-item junction row."),+ "tag_id": UUIDDatabaseField(name="tag_id", description="Tag applied to the account; join to `system.tags.id`."),+ "account_id": UUIDDatabaseField(+ name="account_id", nullable=True, description="Account the tag is applied to; join to `system.accounts.id`."+ ),},)_account_resource_notebooks: _AccountScopedPostgresTable = _AccountScopedPostgresTable(name="_account_resource_notebooks",postgres_table_name="posthog_resourcenotebook",+ description="Internal federated junction table (PostgreSQL `posthog_resourcenotebook`) of notebook-to-account links; not for direct querying — use `system.accounts.notebooks`.",fields={- "id": UUIDDatabaseField(name="id"),- "notebook_id": StringDatabaseField(name="notebook_id"),- "account_id": UUIDDatabaseField(name="account_id", nullable=True),+ "id": UUIDDatabaseField(name="id", description="Primary key of the notebook junction row."),+ "notebook_id": StringDatabaseField(name="notebook_id", description="Identifier of the linked notebook."),+ "account_id": UUIDDatabaseField(+ name="account_id",+ nullable=True,+ description="Account the notebook is linked to; join to `system.accounts.id`.",+ ),},)@@ -90,9 +98,16 @@ def _account_notebooks_select() -> ast.SelectQuery | ast.SelectSetQuery:class _AccountTagsTable(LazyTable):+ description: str = (+ "Internal aggregating table backing `system.accounts.tags`: the distinct, sorted tag names per account."+ )fields: dict[str, FieldOrTable] = {- "account_id": UUIDDatabaseField(name="account_id"),- "names": StringArrayDatabaseField(name="names"),+ "account_id": UUIDDatabaseField(+ name="account_id", description="Account these tags belong to; join to `system.accounts.id`."+ ),+ "names": StringArrayDatabaseField(+ name="names", description="Distinct, sorted tag names applied to the account."+ ),}def lazy_select(@@ -108,9 +123,14 @@ class _AccountTagsTable(LazyTable):class _AccountNotebooksTable(LazyTable):+ description: str = (+ "Internal aggregating table backing `system.accounts.notebooks`: the count of notebooks linked per account."+ )fields: dict[str, FieldOrTable] = {- "account_id": UUIDDatabaseField(name="account_id"),- "count": IntegerDatabaseField(name="count"),+ "account_id": UUIDDatabaseField(+ name="account_id", description="Account these notebooks belong to; join to `system.accounts.id`."+ ),+ "count": IntegerDatabaseField(name="count", description="Number of notebooks linked to the account."),}def lazy_select(diff --git a/posthog/hogql/database/schema/ai_events.py b/posthog/hogql/database/schema/ai_events.pyindex a23ef9cb04f9..4065be185c38 100644--- a/posthog/hogql/database/schema/ai_events.py+++ b/posthog/hogql/database/schema/ai_events.py@@ -15,36 +15,89 @@ from posthog.hogql.database.schema.person_distinct_ids import PersonDistinctIdsTclass AiEventsTable(Table):+ description: str = "AI observability events ($ai_generation, $ai_span, $ai_trace, $ai_evaluation, etc.) capturing model calls, token usage, costs, and trace structure."fields: dict[str, FieldOrTable] = {# Core- "uuid": StringDatabaseField(name="uuid", nullable=False),- "event": StringDatabaseField(name="event", nullable=False),- "timestamp": DateTimeDatabaseField(name="timestamp", nullable=False),+ "uuid": StringDatabaseField(name="uuid", nullable=False, description="Unique identifier of this event row."),+ "event": StringDatabaseField(+ name="event",+ nullable=False,+ description="AI observability event name, e.g. '$ai_generation', '$ai_span', '$ai_trace'.",+ ),+ "timestamp": DateTimeDatabaseField(+ name="timestamp", nullable=False, description="When the event occurred (UTC)."+ ),"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "distinct_id": StringDatabaseField(name="distinct_id", nullable=False),- "person_id": StringDatabaseField(name="person_id", nullable=False),- "properties": StringJSONDatabaseField(name="properties", nullable=False),- "retention_days": IntegerDatabaseField(name="retention_days", nullable=False),+ "distinct_id": StringDatabaseField(+ name="distinct_id",+ nullable=False,+ description="Identifier of the user/device; resolved to a person via `person_id`.",+ ),+ "person_id": StringDatabaseField(+ name="person_id", nullable=False, description="Stable person identifier this event is attributed to."+ ),+ "properties": StringJSONDatabaseField(+ name="properties",+ nullable=False,+ description="JSON map of event properties (raw properties live here).",+ ),+ "retention_days": IntegerDatabaseField(+ name="retention_days", nullable=False, description="Number of days the event is retained for."+ ),# Trace structure- "trace_id": StringDatabaseField(name="trace_id", nullable=False),- "session_id": StringDatabaseField(name="session_id", nullable=True),- "parent_id": StringDatabaseField(name="parent_id", nullable=True),- "span_id": StringDatabaseField(name="span_id", nullable=True),- "span_type": StringDatabaseField(name="span_type", nullable=True),- "generation_id": StringDatabaseField(name="generation_id", nullable=True),- "experiment_id": StringDatabaseField(name="experiment_id", nullable=True),+ "trace_id": StringDatabaseField(+ name="trace_id", nullable=False, description="Identifier of the LLM trace this event belongs to."+ ),+ "session_id": StringDatabaseField(+ name="session_id", nullable=True, description="Session this event belongs to, if set."+ ),+ "parent_id": StringDatabaseField(+ name="parent_id", nullable=True, description="Identifier of the parent span/generation in the trace tree."+ ),+ "span_id": StringDatabaseField(+ name="span_id", nullable=True, description="Identifier of this span within the trace."+ ),+ "span_type": StringDatabaseField(+ name="span_type", nullable=True, description="Type of span, e.g. 'generation', 'span', 'embedding'."+ ),+ "generation_id": StringDatabaseField(+ name="generation_id", nullable=True, description="Identifier of the generation, for $ai_generation events."+ ),+ "experiment_id": StringDatabaseField(+ name="experiment_id",+ nullable=True,+ description="AI observability experiment this event is associated with, if any.",+ ),# Names- "span_name": StringDatabaseField(name="span_name", nullable=True),- "trace_name": StringDatabaseField(name="trace_name", nullable=True),- "prompt_name": StringDatabaseField(name="prompt_name", nullable=True),+ "span_name": StringDatabaseField(+ name="span_name", nullable=True, description="Human-readable name of the span."+ ),+ "trace_name": StringDatabaseField(+ name="trace_name", nullable=True, description="Human-readable name of the trace."+ ),+ "prompt_name": StringDatabaseField(+ name="prompt_name", nullable=True, description="Name of the managed prompt used, if any."+ ),# Model info- "model": StringDatabaseField(name="model", nullable=True),- "provider": StringDatabaseField(name="provider", nullable=True),- "framework": StringDatabaseField(name="framework", nullable=True),+ "model": StringDatabaseField(+ name="model", nullable=True, description="Model used for the call, e.g. 'gpt-4o' or 'claude-3-5-sonnet'."+ ),+ "provider": StringDatabaseField(+ name="provider", nullable=True, description="Model provider, e.g. 'openai', 'anthropic'."+ ),+ "framework": StringDatabaseField(+ name="framework", nullable=True, description="Instrumentation framework used, e.g. 'langchain'."+ ),# Token counts- "total_tokens": IntegerDatabaseField(name="total_tokens", nullable=True),- "input_tokens": IntegerDatabaseField(name="input_tokens", nullable=True),- "output_tokens": IntegerDatabaseField(name="output_tokens", nullable=True),+ "total_tokens": IntegerDatabaseField(+ name="total_tokens", nullable=True, description="Total tokens for the call (input + output)."+ ),+ "input_tokens": IntegerDatabaseField(+ name="input_tokens", nullable=True, description="Number of input/prompt tokens."+ ),+ "output_tokens": IntegerDatabaseField(+ name="output_tokens", nullable=True, description="Number of output/completion tokens."+ ),"text_input_tokens": IntegerDatabaseField(name="text_input_tokens", nullable=True),"text_output_tokens": IntegerDatabaseField(name="text_output_tokens", nullable=True),"image_input_tokens": IntegerDatabaseField(name="image_input_tokens", nullable=True),@@ -53,42 +106,93 @@ class AiEventsTable(Table):"audio_output_tokens": IntegerDatabaseField(name="audio_output_tokens", nullable=True),"video_input_tokens": IntegerDatabaseField(name="video_input_tokens", nullable=True),"video_output_tokens": IntegerDatabaseField(name="video_output_tokens", nullable=True),- "reasoning_tokens": IntegerDatabaseField(name="reasoning_tokens", nullable=True),- "cache_read_input_tokens": IntegerDatabaseField(name="cache_read_input_tokens", nullable=True),- "cache_creation_input_tokens": IntegerDatabaseField(name="cache_creation_input_tokens", nullable=True),- "web_search_count": IntegerDatabaseField(name="web_search_count", nullable=True),+ "reasoning_tokens": IntegerDatabaseField(+ name="reasoning_tokens", nullable=True, description="Number of reasoning/thinking tokens."+ ),+ "cache_read_input_tokens": IntegerDatabaseField(+ name="cache_read_input_tokens",+ nullable=True,+ description="Input tokens served from the provider's prompt cache.",+ ),+ "cache_creation_input_tokens": IntegerDatabaseField(+ name="cache_creation_input_tokens",+ nullable=True,+ description="Input tokens written to the provider's prompt cache.",+ ),+ "web_search_count": IntegerDatabaseField(+ name="web_search_count", nullable=True, description="Number of web searches performed during the call."+ ),# Costs- "input_cost_usd": FloatDatabaseField(name="input_cost_usd", nullable=True),- "output_cost_usd": FloatDatabaseField(name="output_cost_usd", nullable=True),- "total_cost_usd": FloatDatabaseField(name="total_cost_usd", nullable=True),- "request_cost_usd": FloatDatabaseField(name="request_cost_usd", nullable=True),- "web_search_cost_usd": FloatDatabaseField(name="web_search_cost_usd", nullable=True),- "audio_cost_usd": FloatDatabaseField(name="audio_cost_usd", nullable=True),- "image_cost_usd": FloatDatabaseField(name="image_cost_usd", nullable=True),- "video_cost_usd": FloatDatabaseField(name="video_cost_usd", nullable=True),+ "input_cost_usd": FloatDatabaseField(+ name="input_cost_usd", nullable=True, description="Cost of input tokens, in USD."+ ),+ "output_cost_usd": FloatDatabaseField(+ name="output_cost_usd", nullable=True, description="Cost of output tokens, in USD."+ ),+ "total_cost_usd": FloatDatabaseField(+ name="total_cost_usd", nullable=True, description="Total cost of the call, in USD."+ ),+ "request_cost_usd": FloatDatabaseField(+ name="request_cost_usd", nullable=True, description="Per-request/base cost component, in USD."+ ),+ "web_search_cost_usd": FloatDatabaseField(+ name="web_search_cost_usd", nullable=True, description="Cost of web searches, in USD."+ ),+ "audio_cost_usd": FloatDatabaseField(+ name="audio_cost_usd", nullable=True, description="Cost of audio tokens, in USD."+ ),+ "image_cost_usd": FloatDatabaseField(+ name="image_cost_usd", nullable=True, description="Cost of image tokens, in USD."+ ),+ "video_cost_usd": FloatDatabaseField(+ name="video_cost_usd", nullable=True, description="Cost of video tokens, in USD."+ ),# Timing- "latency": FloatDatabaseField(name="latency", nullable=True),- "time_to_first_token": FloatDatabaseField(name="time_to_first_token", nullable=True),+ "latency": FloatDatabaseField(+ name="latency", nullable=True, description="End-to-end latency of the call, in seconds."+ ),+ "time_to_first_token": FloatDatabaseField(+ name="time_to_first_token", nullable=True, description="Time until the first streamed token, in seconds."+ ),# Errors- "is_error": BooleanDatabaseField(name="is_error", nullable=False),- "error": StringDatabaseField(name="error", nullable=True),- "error_type": StringDatabaseField(name="error_type", nullable=True),- "error_normalized": StringDatabaseField(name="error_normalized", nullable=True),+ "is_error": BooleanDatabaseField(+ name="is_error", nullable=False, description="True if the call resulted in an error."+ ),+ "error": StringDatabaseField(name="error", nullable=True, description="Raw error message, if the call failed."),+ "error_type": StringDatabaseField(name="error_type", nullable=True, description="Classification of the error."),+ "error_normalized": StringDatabaseField(+ name="error_normalized", nullable=True, description="Normalized/grouped error string for aggregation."+ ),# Heavy columns (JSON strings — use StringJSONDatabaseField so HogQL# handles array/object access via JSONExtract under the hood)- "input": StringJSONDatabaseField(name="input", nullable=True),- "output": StringJSONDatabaseField(name="output", nullable=True),- "output_choices": StringJSONDatabaseField(name="output_choices", nullable=True),- "input_state": StringJSONDatabaseField(name="input_state", nullable=True),- "output_state": StringJSONDatabaseField(name="output_state", nullable=True),- "tools": StringJSONDatabaseField(name="tools", nullable=True),+ "input": StringJSONDatabaseField(+ name="input", nullable=True, description="JSON of the model input (prompt/messages)."+ ),+ "output": StringJSONDatabaseField(+ name="output", nullable=True, description="JSON of the model output/completion."+ ),+ "output_choices": StringJSONDatabaseField(+ name="output_choices", nullable=True, description="JSON of the output choices returned by the model."+ ),+ "input_state": StringJSONDatabaseField(+ name="input_state", nullable=True, description="JSON of the input state for span/trace events."+ ),+ "output_state": StringJSONDatabaseField(+ name="output_state", nullable=True, description="JSON of the output state for span/trace events."+ ),+ "tools": StringJSONDatabaseField(+ name="tools", nullable=True, description="JSON of the tool/function definitions available to the model."+ ),# Person join via person_distinct_ids"pdi": LazyJoin(from_field=["distinct_id"],join_table=PersonDistinctIdsTable(),resolver=PERSON_DISTINCT_IDS,),- "person": FieldTraverser(chain=["pdi", "person"]),+ "person": FieldTraverser(+ chain=["pdi", "person"],+ description="The person this event is attributed to; access via `person.properties.*`.",+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/app_metrics2.py b/posthog/hogql/database/schema/app_metrics2.pyindex 6c583bd941ba..bdd7e016aa84 100644--- a/posthog/hogql/database/schema/app_metrics2.py+++ b/posthog/hogql/database/schema/app_metrics2.py@@ -8,17 +8,40 @@ from posthog.hogql.database.models import (APP_METRICS2_FIELDS: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "app_source": StringDatabaseField(name="app_source", nullable=False),- "app_source_id": StringDatabaseField(name="app_source_id", nullable=False),- "instance_id": StringDatabaseField(name="instance_id", nullable=False),- "timestamp": DateTimeDatabaseField(name="timestamp", nullable=False),- "metric_name": StringDatabaseField(name="metric_name", nullable=False),- "metric_kind": StringDatabaseField(name="metric_kind", nullable=False),- "count": IntegerDatabaseField(name="count", nullable=False),+ "app_source": StringDatabaseField(+ name="app_source",+ nullable=False,+ description="Kind of app that produced the metric, e.g. 'hog_function' or 'plugin'.",+ ),+ "app_source_id": StringDatabaseField(+ name="app_source_id",+ nullable=False,+ description="Identifier of the specific app/function the metric belongs to.",+ ),+ "instance_id": StringDatabaseField(+ name="instance_id",+ nullable=False,+ description="Identifier of the specific run/instance that emitted the metric.",+ ),+ "timestamp": DateTimeDatabaseField(+ name="timestamp", nullable=False, description="Bucketed time the metric count applies to."+ ),+ "metric_name": StringDatabaseField(+ name="metric_name", nullable=False, description="Name of the metric, e.g. 'succeeded', 'failed', 'filtered'."+ ),+ "metric_kind": StringDatabaseField(+ name="metric_kind", nullable=False, description="Category of the metric, e.g. 'success', 'failure', 'other'."+ ),+ "count": IntegerDatabaseField(+ name="count", nullable=False, description="Number of occurrences for this metric in the time bucket."+ ),}class AppMetrics2Table(Table):+ description: str = (+ "Aggregated success/failure counts emitted by apps such as hog functions and plugins, bucketed by time."+ )fields: dict[str, FieldOrTable] = APP_METRICS2_FIELDSdef to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/cohort_membership.py b/posthog/hogql/database/schema/cohort_membership.pyindex 0177b02dc698..2bb8928cfff0 100644--- a/posthog/hogql/database/schema/cohort_membership.py+++ b/posthog/hogql/database/schema/cohort_membership.py@@ -11,12 +11,27 @@ from posthog.hogql.database.models import (class CohortMembershipTable(Table):"""Table tracking realtime cohort membership changes."""+ description: str = (+ "Realtime cohort membership changes, one row per person per cohort kept at its latest state. "+ "Records when a person enters or leaves a cohort, as evaluated by the realtime cohorts pipeline."+ )+fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "cohort_id": IntegerDatabaseField(name="cohort_id", nullable=False),- "person_id": UUIDDatabaseField(name="person_id", nullable=False),- "status": StringDatabaseField(name="status", nullable=False),- "last_updated": DateTimeDatabaseField(name="last_updated", nullable=False),+ "cohort_id": IntegerDatabaseField(+ name="cohort_id", nullable=False, description="Identifier of the cohort whose membership changed."+ ),+ "person_id": UUIDDatabaseField(+ name="person_id", nullable=False, description="Person whose membership changed; join to `persons.id`."+ ),+ "status": StringDatabaseField(+ name="status",+ nullable=False,+ description="Latest membership status for this person/cohort: 'entered' or 'left'.",+ ),+ "last_updated": DateTimeDatabaseField(+ name="last_updated", nullable=False, description="When this membership status was last updated (UTC)."+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/cohort_people.py b/posthog/hogql/database/schema/cohort_people.pyindex 1cbac9fc5298..ddbd6669aff2 100644--- a/posthog/hogql/database/schema/cohort_people.py+++ b/posthog/hogql/database/schema/cohort_people.py@@ -10,8 +10,12 @@ from posthog.hogql.database.models import ()COHORT_PEOPLE_FIELDS: dict[str, FieldOrTable] = {- "person_id": StringDatabaseField(name="person_id", nullable=False),- "cohort_id": IntegerDatabaseField(name="cohort_id", nullable=False),+ "person_id": StringDatabaseField(+ name="person_id", nullable=False, description="Person who is a member of the cohort; join to `persons.id`."+ ),+ "cohort_id": IntegerDatabaseField(+ name="cohort_id", nullable=False, description="Identifier of the cohort this person belongs to."+ ),"team_id": IntegerDatabaseField(name="team_id", nullable=False),"person": LazyJoin(from_field=["person_id"],@@ -60,10 +64,23 @@ def select_from_cohort_people_table(requested_fields: dict[str, list[str | int]]class RawCohortPeople(Table):+ description: str = (+ "Raw membership rows for dynamic (calculated) cohorts, one row per person per cohort version. "+ "Backed by a CollapsingMergeTree, so rows must be summed by `sign` and filtered to the latest "+ "`version`; query the `cohort_people` lazy table instead, which does this for you."+ )fields: dict[str, FieldOrTable] = {**COHORT_PEOPLE_FIELDS,- "sign": IntegerDatabaseField(name="sign", nullable=False),- "version": IntegerDatabaseField(name="version", nullable=False),+ "sign": IntegerDatabaseField(+ name="sign",+ nullable=False,+ description="CollapsingMergeTree sign: +1 adds a membership row, -1 cancels it; sum to get current membership.",+ ),+ "version": IntegerDatabaseField(+ name="version",+ nullable=False,+ description="Cohort calculation version this row belongs to; only the latest version per cohort is current.",+ ),}def to_printed_clickhouse(self, context):@@ -74,6 +91,11 @@ class RawCohortPeople(Table):class CohortPeople(LazyTable):+ description: str = (+ "Current membership of dynamic (calculated) cohorts: one row per person per cohort, "+ "already deduplicated to the latest cohort version. Use this to find which persons are in a cohort. "+ "Static (CSV-imported) cohorts live in `static_cohort_people`."+ )fields: dict[str, FieldOrTable] = COHORT_PEOPLE_FIELDSdef lazy_select(self, table_to_add: LazyTableToAdd, context, node):diff --git a/posthog/hogql/database/schema/conversion_goal_attributed_preaggregated.py b/posthog/hogql/database/schema/conversion_goal_attributed_preaggregated.pyindex 4483c836c2a3..a5da5f842299 100644--- a/posthog/hogql/database/schema/conversion_goal_attributed_preaggregated.py+++ b/posthog/hogql/database/schema/conversion_goal_attributed_preaggregated.py@@ -20,22 +20,46 @@ from posthog.clickhouse.preaggregation.conversion_goal_attributed_sql import (def _build_fields() -> dict[str, FieldOrTable]:fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id"),- "job_id": StringDatabaseField(name="job_id"),- "person_id": StringDatabaseField(name="person_id"),- "conversion_timestamp": DateTimeDatabaseField(name="conversion_timestamp"),- "conversion_value": FloatDatabaseField(name="conversion_value"),- "touchpoint_timestamp": DateTimeDatabaseField(name="touchpoint_timestamp"),- "touchpoint_weight": FloatDatabaseField(name="touchpoint_weight"),+ "job_id": StringDatabaseField(+ name="job_id", description="Identifier of the preaggregation job that produced this row."+ ),+ "person_id": StringDatabaseField(+ name="person_id", description="Person credited with the conversion; join to `persons`."+ ),+ "conversion_timestamp": DateTimeDatabaseField(+ name="conversion_timestamp", description="When the conversion occurred (UTC)."+ ),+ "conversion_value": FloatDatabaseField(+ name="conversion_value",+ description="Value of the conversion (e.g. revenue or count for the conversion goal).",+ ),+ "touchpoint_timestamp": DateTimeDatabaseField(+ name="touchpoint_timestamp", description="When the attributed marketing touchpoint occurred (UTC)."+ ),+ "touchpoint_weight": FloatDatabaseField(+ name="touchpoint_weight",+ description="Attribution weight of this touchpoint; single-touch is 1.0, multi-touch emits fractional weights summing to 1 across the conversion's rows.",+ ),}for tracked_name in CONVERSION_GOAL_ATTRIBUTED_TRACKED_FIELD_NAMES:col = f"{tracked_name}_name"- fields[col] = StringDatabaseField(name=col)- fields["computed_at"] = DateTimeDatabaseField(name="computed_at")- fields["expires_at"] = DateDatabaseField(name="expires_at")+ fields[col] = StringDatabaseField(+ name=col, description=f"Value of the '{tracked_name}' marketing attribute for the attributed touchpoint."+ )+ fields["computed_at"] = DateTimeDatabaseField(+ name="computed_at", description="When this preaggregated row was computed; also the ReplacingMergeTree version."+ )+ fields["expires_at"] = DateDatabaseField(+ name="expires_at", description="Date when this row expires and is dropped via TTL."+ )return fieldsclass ConversionGoalAttributedPreaggregatedTable(Table):+ description: str = (+ "Internal preaggregated table holding the attributed output of the conversion-goal pipeline: "+ "one row per (team, job, person, conversion, touchpoint) with the attribution weight for that touchpoint."+ )top_level_settings: HogQLQuerySettings | None = Field(default_factory=lambda: HogQLQuerySettings(load_balancing="in_order"))diff --git a/posthog/hogql/database/schema/document_embeddings.py b/posthog/hogql/database/schema/document_embeddings.pyindex 22ed2969b065..c8d2f27ccaba 100644--- a/posthog/hogql/database/schema/document_embeddings.py+++ b/posthog/hogql/database/schema/document_embeddings.py@@ -22,16 +22,40 @@ DOCUMENT_EMBEDDINGS_VIEW = "posthog_document_embeddings_union_view"DOCUMENT_EMBEDDINGS_FIELDS: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "product": StringDatabaseField(name="product", nullable=False),- "document_type": StringDatabaseField(name="document_type", nullable=False),- "model_name": StringDatabaseField(name="model_name", nullable=False),- "rendering": StringDatabaseField(name="rendering", nullable=False),- "document_id": StringDatabaseField(name="document_id", nullable=False),- "timestamp": DateTimeDatabaseField(name="timestamp", nullable=False),- "inserted_at": DateTimeDatabaseField(name="inserted_at", nullable=False),- "content": StringDatabaseField(name="content", nullable=False),- "metadata": StringJSONDatabaseField(name="metadata", nullable=False),- "embedding": FloatArrayDatabaseField(name="embedding", nullable=False),+ "product": StringDatabaseField(+ name="product",+ nullable=False,+ description="PostHog product the embedded document belongs to, e.g. 'error_tracking'.",+ ),+ "document_type": StringDatabaseField(+ name="document_type", nullable=False, description="Type of document this embedding represents."+ ),+ "model_name": StringDatabaseField(+ name="model_name",+ nullable=False,+ description="Embedding model used; queries must filter on this to route to the correct model-specific table.",+ ),+ "rendering": StringDatabaseField(+ name="rendering", nullable=False, description="How the document was rendered to text before embedding."+ ),+ "document_id": StringDatabaseField(+ name="document_id", nullable=False, description="Identifier of the source document that was embedded."+ ),+ "timestamp": DateTimeDatabaseField(+ name="timestamp", nullable=False, description="Timestamp of the source document."+ ),+ "inserted_at": DateTimeDatabaseField(+ name="inserted_at", nullable=False, description="When this embedding row was inserted."+ ),+ "content": StringDatabaseField(name="content", nullable=False, description="The text content that was embedded."),+ "metadata": StringJSONDatabaseField(+ name="metadata", nullable=False, description="JSON metadata about the document/embedding."+ ),+ "embedding": FloatArrayDatabaseField(+ name="embedding",+ nullable=False,+ description="The embedding vector; compare with `cosineDistance`/`L2Distance` for semantic search.",+ ),}@@ -89,6 +113,7 @@ def extract_model_name_from_where(node: Optional[ast.Expr]) -> Optional[str]:class ModelSpecificEmbeddingTable(Table):+ description: str = "Document embeddings for a single embedding model; the `model_name` column is fixed per table."model_name: str = ""clickhouse_table_name: str = ""@@ -116,6 +141,7 @@ HOGQL_MODEL_TABLES = {table.to_printed_hogql(): table for table in HOGQL_EMBEDDIclass DocumentEmbeddingsTable(LazyTable):+ description: str = "Vector embeddings of PostHog documents for semantic search; queries must filter on `model_name` to route to the right model-specific table."fields: dict[str, FieldOrTable] = DOCUMENT_EMBEDDINGS_FIELDSdef lazy_select(@@ -168,6 +194,9 @@ class DocumentEmbeddingsTable(LazyTable):class RawDocumentEmbeddingsTable(Table):+ description: str = (+ "Union view over all model-specific document embedding tables; prefer `document_embeddings` for queries."+ )fields: dict[str, FieldOrTable] = DOCUMENT_EMBEDDINGS_FIELDSdef to_printed_clickhouse(self, context: HogQLContext):diff --git a/posthog/hogql/database/schema/duckdb_table_functions.py b/posthog/hogql/database/schema/duckdb_table_functions.pyindex b4dec65cf030..2d74b684d88d 100644--- a/posthog/hogql/database/schema/duckdb_table_functions.py+++ b/posthog/hogql/database/schema/duckdb_table_functions.py@@ -63,8 +63,12 @@ def is_dangerous_table_function(name: str) -> bool:class RangeTable(FunctionCallTable, DANGEROUS_NoTeamIdCheckTable):"""DuckDB/Postgres range(start, stop, step) table function. Returns a single column of integers."""+ description: str = (+ "DuckDB/Postgres range(start, stop, step) table function. Generates a single column of integers; "+ "the stop value is exclusive. Not supported in the ClickHouse dialect."+ )fields: dict[str, FieldOrTable] = {- "range": IntegerDatabaseField(name="range", nullable=False),+ "range": IntegerDatabaseField(name="range", nullable=False, description="The generated integer value."),}name: str = "range"@@ -84,8 +88,14 @@ class RangeTable(FunctionCallTable, DANGEROUS_NoTeamIdCheckTable):class GenerateSeriesTable(FunctionCallTable, DANGEROUS_NoTeamIdCheckTable):"""DuckDB/Postgres generate_series(start, stop, step) table function. Returns a single column of integers."""+ description: str = (+ "DuckDB/Postgres generate_series(start, stop, step) table function. Generates a single column of integers; "+ "the stop value is inclusive. Not supported in the ClickHouse dialect."+ )fields: dict[str, FieldOrTable] = {- "generate_series": IntegerDatabaseField(name="generate_series", nullable=False),+ "generate_series": IntegerDatabaseField(+ name="generate_series", nullable=False, description="The generated integer value."+ ),}name: str = "generate_series"@@ -122,6 +132,10 @@ class OpaqueFunctionCallTable(FunctionCallTable, DANGEROUS_NoTeamIdCheckTable):but the function name appears in the connection's available_table_functions."""+ description: str = (+ "Generic fallback for a Postgres/DuckDB table-valued function discovered via connection introspection. "+ "Exposes a single column named after the function with an unknown type. Not supported in the ClickHouse dialect."+ )fields: dict[str, FieldOrTable]name: strrequires_args: bool = Truediff --git a/posthog/hogql/database/schema/error_tracking_fingerprint_issue_state.py b/posthog/hogql/database/schema/error_tracking_fingerprint_issue_state.pyindex cebef1d2a44c..9402ef43e498 100644--- a/posthog/hogql/database/schema/error_tracking_fingerprint_issue_state.py+++ b/posthog/hogql/database/schema/error_tracking_fingerprint_issue_state.py@@ -22,14 +22,34 @@ PENDING_UPDATES_HOGQL_CONTEXT_KEY = "error_tracking_fingerprints"ERROR_TRACKING_FINGERPRINT_ISSUE_STATE_FIELDS: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "fingerprint": StringDatabaseField(name="fingerprint", nullable=False),- "issue_id": StringDatabaseField(name="issue_id", nullable=True),- "issue_name": StringDatabaseField(name="issue_name", nullable=True),- "issue_description": StringDatabaseField(name="issue_description", nullable=True),- "issue_status": StringDatabaseField(name="issue_status", nullable=True),- "assigned_user_id": IntegerDatabaseField(name="assigned_user_id", nullable=True),- "assigned_role_id": UUIDDatabaseField(name="assigned_role_id", nullable=True),- "first_seen": DateTimeDatabaseField(name="first_seen", nullable=True),+ "fingerprint": StringDatabaseField(+ name="fingerprint",+ nullable=False,+ description="Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",+ ),+ "issue_id": StringDatabaseField(+ name="issue_id",+ nullable=True,+ description="Identifier of the error tracking issue this fingerprint belongs to.",+ ),+ "issue_name": StringDatabaseField(+ name="issue_name", nullable=True, description="Display name of the issue (latest version)."+ ),+ "issue_description": StringDatabaseField(+ name="issue_description", nullable=True, description="Description of the issue (latest version)."+ ),+ "issue_status": StringDatabaseField(+ name="issue_status", nullable=True, description="Current status of the issue, e.g. 'active', 'resolved'."+ ),+ "assigned_user_id": IntegerDatabaseField(+ name="assigned_user_id", nullable=True, description="User the issue is assigned to, if any."+ ),+ "assigned_role_id": UUIDDatabaseField(+ name="assigned_role_id", nullable=True, description="Role the issue is assigned to, if any."+ ),+ "first_seen": DateTimeDatabaseField(+ name="first_seen", nullable=True, description="When the issue was first observed (in UTC)."+ ),}RAW_TABLE_NAME = "raw_error_tracking_fingerprint_issue_state"@@ -226,10 +246,22 @@ def _pending_update_select(row: dict[str, Any]):class RawErrorTrackingFingerprintIssueStateTable(Table):+ description: str = (+ "Raw ReplacingMergeTree backing the issue state of each exception fingerprint; "+ "rows are versioned, so query the deduplicated `error_tracking_fingerprint_issue_state` table instead."+ )fields: dict[str, FieldOrTable] = {**ERROR_TRACKING_FINGERPRINT_ISSUE_STATE_FIELDS,- "is_deleted": BooleanDatabaseField(name="is_deleted", nullable=False),- "version": IntegerDatabaseField(name="version", nullable=False),+ "is_deleted": BooleanDatabaseField(+ name="is_deleted",+ nullable=False,+ description="Whether this version marks the fingerprint state as deleted.",+ ),+ "version": IntegerDatabaseField(+ name="version",+ nullable=False,+ description="Monotonic version; the latest version wins after deduplication.",+ ),}def to_printed_clickhouse(self, context):@@ -240,11 +272,17 @@ class RawErrorTrackingFingerprintIssueStateTable(Table):class ErrorTrackingFingerprintIssueStateTable(LazyTable):+ description: str = (+ "Deduplicated latest issue state for each exception fingerprint; "+ "join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint."+ )# `fp_hash` is a computed alias produced by `lazy_select`, not a physical# column — so it lives here, not on the raw table.fields: dict[str, FieldOrTable] = {**ERROR_TRACKING_FINGERPRINT_ISSUE_STATE_FIELDS,- "fp_hash": IntegerDatabaseField(name="fp_hash", nullable=False),+ "fp_hash": IntegerDatabaseField(+ name="fp_hash", nullable=False, description="cityHash64 of the fingerprint, used as the join/group key."+ ),}def lazy_select(diff --git a/posthog/hogql/database/schema/error_tracking_issue_fingerprint_overrides.py b/posthog/hogql/database/schema/error_tracking_issue_fingerprint_overrides.pyindex 2ff8b228687e..440ba12c4002 100644--- a/posthog/hogql/database/schema/error_tracking_issue_fingerprint_overrides.py+++ b/posthog/hogql/database/schema/error_tracking_issue_fingerprint_overrides.py@@ -16,8 +16,14 @@ from posthog.hogql.errors import ResolutionErrorERROR_TRACKING_ISSUE_FINGERPRINT_OVERRIDES_FIELDS: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "fingerprint": StringDatabaseField(name="fingerprint", nullable=False),- "issue_id": StringDatabaseField(name="issue_id", nullable=False),+ "fingerprint": StringDatabaseField(+ name="fingerprint",+ nullable=False,+ description="Exception fingerprint; matches `events.properties.$exception_fingerprint`.",+ ),+ "issue_id": StringDatabaseField(+ name="issue_id", nullable=False, description="Identifier of the error tracking issue this fingerprint maps to."+ ),}@@ -62,10 +68,20 @@ def select_from_error_tracking_issue_fingerprint_overrides_table(requested_fieldclass RawErrorTrackingIssueFingerprintOverridesTable(Table):+ description: str = (+ "Raw versioned mapping of exception fingerprints to issues, used to override default fingerprint grouping; "+ "query the deduplicated `error_tracking_issue_fingerprint_overrides` table instead."+ )fields: dict[str, FieldOrTable] = {**ERROR_TRACKING_ISSUE_FINGERPRINT_OVERRIDES_FIELDS,- "is_deleted": BooleanDatabaseField(name="is_deleted", nullable=False),- "version": IntegerDatabaseField(name="version", nullable=False),+ "is_deleted": BooleanDatabaseField(+ name="is_deleted", nullable=False, description="Whether this version marks the override as deleted."+ ),+ "version": IntegerDatabaseField(+ name="version",+ nullable=False,+ description="Monotonic version; the latest version wins after deduplication.",+ ),}def to_printed_clickhouse(self, context):@@ -76,6 +92,10 @@ class RawErrorTrackingIssueFingerprintOverridesTable(Table):class ErrorTrackingIssueFingerprintOverridesTable(LazyTable):+ description: str = (+ "Deduplicated mapping of exception fingerprints to the issue they were reassigned to, "+ "overriding default grouping. One row per fingerprint."+ )fields: dict[str, FieldOrTable] = ERROR_TRACKING_ISSUE_FINGERPRINT_OVERRIDES_FIELDSdef lazy_select(diff --git a/posthog/hogql/database/schema/event_sessions.py b/posthog/hogql/database/schema/event_sessions.pyindex 4d7f5c0ea2a6..d293b3d6589e 100644--- a/posthog/hogql/database/schema/event_sessions.py+++ b/posthog/hogql/database/schema/event_sessions.py@@ -16,9 +16,19 @@ from posthog.hogql.visitor import CloningVisitor, GetFieldsTraverser, Traversingclass EventsSessionSubTable(VirtualTable):+ description: str = (+ "Virtual per-event session summary computed from the events table, exposed as `events.session`. "+ "Provides the session id and duration without joining the sessions table."+ )fields: dict[str, FieldOrTable] = {- "id": StringDatabaseField(name="$session_id", nullable=False),- "duration": IntegerDatabaseField(name="session_duration", nullable=False),+ "id": StringDatabaseField(+ name="$session_id", nullable=False, description="Session identifier; matches `events.$session_id`."+ ),+ "duration": IntegerDatabaseField(+ name="session_duration",+ nullable=False,+ description="Session duration in seconds, computed as max(timestamp) - min(timestamp) over the session's events.",+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/exchange_rate.py b/posthog/hogql/database/schema/exchange_rate.pyindex cd6ab8af3983..4ca0bc587ab0 100644--- a/posthog/hogql/database/schema/exchange_rate.py+++ b/posthog/hogql/database/schema/exchange_rate.py@@ -17,10 +17,18 @@ if TYPE_CHECKING:class ExchangeRateTable(DANGEROUS_NoTeamIdCheckTable):+ description: str = (+ "Daily currency-to-USD conversion rates used by revenue analytics. One row per currency per date; "+ "shared across all teams (not team-scoped)."+ )fields: dict[str, FieldOrTable] = {- "currency": StringDatabaseField(name="currency", nullable=False),- "date": DateDatabaseField(name="date", nullable=False),- "rate": DecimalDatabaseField(name="rate", nullable=False),+ "currency": StringDatabaseField(+ name="currency", nullable=False, description="ISO 4217 currency code, e.g. 'EUR' or 'GBP'."+ ),+ "date": DateDatabaseField(name="date", nullable=False, description="Calendar date the rate applies to."),+ "rate": DecimalDatabaseField(+ name="rate", nullable=False, description="This currency's rate relative to USD on the given date."+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/experiment_exposures_preaggregated.py b/posthog/hogql/database/schema/experiment_exposures_preaggregated.pyindex f44e8f7d90f1..37d4a774d106 100644--- a/posthog/hogql/database/schema/experiment_exposures_preaggregated.py+++ b/posthog/hogql/database/schema/experiment_exposures_preaggregated.py@@ -14,20 +14,42 @@ from posthog.clickhouse.preaggregation.experiment_exposures_sql import DISTRIBUTclass ExperimentExposuresPreaggregatedTable(Table):+ description: str = (+ "Internal preaggregated table of experiment exposures, one row per entity per experiment job recording the "+ "variant the entity was exposed to and the exposure time window."+ )top_level_settings: HogQLQuerySettings | None = Field(default_factory=lambda: HogQLQuerySettings(load_balancing="in_order"))fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id"),- "job_id": StringDatabaseField(name="job_id"),- "entity_id": StringDatabaseField(name="entity_id"),- "variant": StringDatabaseField(name="variant"),- "first_exposure_time": DateTimeDatabaseField(name="first_exposure_time"),- "last_exposure_time": DateTimeDatabaseField(name="last_exposure_time"),- "exposure_event_uuid": StringDatabaseField(name="exposure_event_uuid"),- "exposure_session_id": StringDatabaseField(name="exposure_session_id"),- "breakdown_value": StringArrayDatabaseField(name="breakdown_value"),+ "job_id": StringDatabaseField(+ name="job_id", description="Identifier of the preaggregation job that produced this row."+ ),+ "entity_id": StringDatabaseField(+ name="entity_id", description="Identifier of the exposed entity (person or group) being analyzed."+ ),+ "variant": StringDatabaseField(+ name="variant", description="Experiment variant the entity was exposed to (e.g. 'control', 'test')."+ ),+ "first_exposure_time": DateTimeDatabaseField(+ name="first_exposure_time", description="Timestamp of the entity's first exposure to the experiment (UTC)."+ ),+ "last_exposure_time": DateTimeDatabaseField(+ name="last_exposure_time",+ description="Timestamp of the entity's most recent exposure to the experiment (UTC).",+ ),+ "exposure_event_uuid": StringDatabaseField(+ name="exposure_event_uuid",+ description="UUID of the event that recorded the first exposure; join to `events.uuid`.",+ ),+ "exposure_session_id": StringDatabaseField(+ name="exposure_session_id", description="Session in which the first exposure occurred; join to `sessions`."+ ),+ "breakdown_value": StringArrayDatabaseField(+ name="breakdown_value", description="Breakdown dimension values associated with this exposure."+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/experiment_metric_events_preaggregated.py b/posthog/hogql/database/schema/experiment_metric_events_preaggregated.pyindex 37b08c50044c..ff5f4acc7417 100644--- a/posthog/hogql/database/schema/experiment_metric_events_preaggregated.py+++ b/posthog/hogql/database/schema/experiment_metric_events_preaggregated.py@@ -14,21 +14,38 @@ from posthog.clickhouse.preaggregation.experiment_metric_events_sql import DISTRclass ExperimentMetricEventsPreaggregatedTable(Table):+ description: str = (+ "Internal preaggregated table of experiment metric events, one row per metric-contributing event recording "+ "its numeric value and (for funnel metrics) the steps completed. Powers experiment results computation."+ )top_level_settings: HogQLQuerySettings | None = Field(default_factory=lambda: HogQLQuerySettings(load_balancing="in_order"))fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id"),- "job_id": StringDatabaseField(name="job_id"),- "entity_id": StringDatabaseField(name="entity_id"),- "timestamp": DateTimeDatabaseField(name="timestamp"),- "event_uuid": StringDatabaseField(name="event_uuid"),- "session_id": StringDatabaseField(name="session_id"),- "numeric_value": FloatDatabaseField(name="numeric_value"),+ "job_id": StringDatabaseField(+ name="job_id", description="Identifier of the preaggregation job that produced this row."+ ),+ "entity_id": StringDatabaseField(+ name="entity_id", description="Identifier of the entity (person or group) the metric event belongs to."+ ),+ "timestamp": DateTimeDatabaseField(name="timestamp", description="When the metric event occurred (UTC)."),+ "event_uuid": StringDatabaseField(+ name="event_uuid", description="UUID of the source event; join to `events.uuid`."+ ),+ "session_id": StringDatabaseField(+ name="session_id", description="Session in which the metric event occurred; join to `sessions`."+ ),+ "numeric_value": FloatDatabaseField(+ name="numeric_value", description="Numeric value the event contributes to the experiment metric."+ ),# steps is Array(UInt8) in ClickHouse but HogQL doesn't have a typed array field;# queries will use arrayElement() to access individual step indicators- "steps": StringDatabaseField(name="steps"),+ "steps": StringDatabaseField(+ name="steps",+ description="Per-step funnel completion indicators (ClickHouse Array(UInt8)); access individual steps with arrayElement().",+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/groups.py b/posthog/hogql/database/schema/groups.pyindex 7b3396e075bc..ed3515f516cb 100644--- a/posthog/hogql/database/schema/groups.py+++ b/posthog/hogql/database/schema/groups.py@@ -18,12 +18,30 @@ from posthog.hogql.database.schema.groups_revenue_analytics import GroupsRevenuefrom posthog.hogql.errors import ResolutionErrorGROUPS_TABLE_FIELDS: dict[str, FieldOrTable] = {- "index": IntegerDatabaseField(name="group_type_index", nullable=False),+ "index": IntegerDatabaseField(+ name="group_type_index",+ nullable=False,+ description="Group type index (0-4); identifies which group type this row belongs to, matching `events.$group_N`.",+ ),"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "key": StringDatabaseField(name="group_key", nullable=False),- "created_at": DateTimeDatabaseField(name="created_at", nullable=False),- "updated_at": DateTimeDatabaseField(name="_timestamp", nullable=False),- "properties": StringJSONDatabaseField(name="group_properties", nullable=False),+ "key": StringDatabaseField(+ name="group_key",+ nullable=False,+ description="Unique key for the group within its group type; join target for `events.$group_N`.",+ ),+ "created_at": DateTimeDatabaseField(+ name="created_at", nullable=False, description="When the group was first created in PostHog."+ ),+ "updated_at": DateTimeDatabaseField(+ name="_timestamp",+ nullable=False,+ description="When this group row was last written (ingestion timestamp); used to pick the latest version.",+ ),+ "properties": StringJSONDatabaseField(+ name="group_properties",+ nullable=False,+ description="JSON map of group properties (latest known values). Access keys with `properties.name` etc.",+ ),"revenue_analytics": LazyJoin(from_field=["key"],join_table=GroupsRevenueAnalyticsTable(),@@ -80,6 +98,10 @@ def join_with_group_n_table(class RawGroupsTable(Table):+ description: str = (+ "Raw, un-deduplicated groups rows (one per update). Query `groups` instead unless you need to "+ "resolve the latest version of each group's properties yourself."+ )fields: dict[str, FieldOrTable] = GROUPS_TABLE_FIELDSdef to_printed_clickhouse(self, context):@@ -90,6 +112,10 @@ class RawGroupsTable(Table):class GroupsTable(LazyTable):+ description: str = (+ "Deduplicated groups (companies, organizations, etc.) in the project, with their latest properties. "+ "One row per (group type, group key). Join from events via `events.$group_N = groups.key`."+ )fields: dict[str, FieldOrTable] = GROUPS_TABLE_FIELDSdef lazy_select(self, table_to_add: LazyTableToAdd, context, node):diff --git a/posthog/hogql/database/schema/groups_revenue_analytics.py b/posthog/hogql/database/schema/groups_revenue_analytics.pyindex 3d735c93e531..e36ecab85a80 100644--- a/posthog/hogql/database/schema/groups_revenue_analytics.py+++ b/posthog/hogql/database/schema/groups_revenue_analytics.py@@ -23,9 +23,20 @@ ZERO_DECIMAL = ast.Call(FIELDS: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id"),- "group_key": StringDatabaseField(name="group_key"),- "revenue": DecimalDatabaseField(name="revenue", nullable=False),- "mrr": DecimalDatabaseField(name="mrr", nullable=False),+ "group_key": StringDatabaseField(+ name="group_key",+ description="Group key these revenue figures are aggregated for; join target for `groups.key`.",+ ),+ "revenue": DecimalDatabaseField(+ name="revenue",+ nullable=False,+ description="Total revenue attributed to the group, summed across all its customers, in the project's base currency.",+ ),+ "mrr": DecimalDatabaseField(+ name="mrr",+ nullable=False,+ description="Monthly recurring revenue attributed to the group, summed across all its customers, in the project's base currency.",+ ),}@@ -362,6 +373,10 @@ def _build_dw_query(class GroupsRevenueAnalyticsTable(LazyTable):+ description: str = (+ "Revenue and MRR aggregated per group from the revenue analytics views. "+ "One row per group key; reachable from groups via the `revenue_analytics` join."+ )fields: dict[str, FieldOrTable] = FIELDSdef lazy_select(diff --git a/posthog/hogql/database/schema/heatmaps.py b/posthog/hogql/database/schema/heatmaps.pyindex 5e30c9552066..05703d5df40a 100644--- a/posthog/hogql/database/schema/heatmaps.py+++ b/posthog/hogql/database/schema/heatmaps.py@@ -9,19 +9,55 @@ from posthog.hogql.database.models import (class HeatmapsTable(Table):+ description: str = (+ "Individual heatmap interactions (clicks, rage clicks, mouse moves, scrolls) captured from $heatmap events; "+ "one row per interaction, used to build click/scroll heatmaps per URL."+ )fields: dict[str, FieldOrTable] = {- "session_id": StringDatabaseField(name="session_id", nullable=False),+ "session_id": StringDatabaseField(+ name="session_id",+ nullable=False,+ description="Recording session the interaction belongs to; matches `session_replay_events.session_id`.",+ ),"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "distinct_id": StringDatabaseField(name="distinct_id", nullable=False),- "x": IntegerDatabaseField(name="x", nullable=False),- "y": IntegerDatabaseField(name="y", nullable=False),- "scale_factor": IntegerDatabaseField(name="scale_factor", nullable=False),- "viewport_width": IntegerDatabaseField(name="viewport_width", nullable=False),- "viewport_height": IntegerDatabaseField(name="viewport_height", nullable=False),- "pointer_target_fixed": BooleanDatabaseField(name="pointer_target_fixed", nullable=False),- "current_url": StringDatabaseField(name="current_url", nullable=False),- "timestamp": DateTimeDatabaseField(name="timestamp", nullable=False),- "type": StringDatabaseField(name="type", nullable=False),+ "distinct_id": StringDatabaseField(+ name="distinct_id", nullable=False, description="Identifier of the user/device that interacted."+ ),+ "x": IntegerDatabaseField(+ name="x",+ nullable=False,+ description="X coordinate snapped to an NxN grid; multiply by `scale_factor` for the original pixel value.",+ ),+ "y": IntegerDatabaseField(+ name="y",+ nullable=False,+ description="Y coordinate snapped to an NxN grid; multiply by `scale_factor` for the original pixel value.",+ ),+ "scale_factor": IntegerDatabaseField(+ name="scale_factor", nullable=False, description="Grid resolution applied to `x`/`y` coordinates."+ ),+ "viewport_width": IntegerDatabaseField(+ name="viewport_width", nullable=False, description="Browser viewport width at capture time, in pixels."+ ),+ "viewport_height": IntegerDatabaseField(+ name="viewport_height", nullable=False, description="Browser viewport height at capture time, in pixels."+ ),+ "pointer_target_fixed": BooleanDatabaseField(+ name="pointer_target_fixed",+ nullable=False,+ description="Whether the clicked element stays fixed when the page scrolls.",+ ),+ "current_url": StringDatabaseField(+ name="current_url", nullable=False, description="URL of the page where the interaction occurred."+ ),+ "timestamp": DateTimeDatabaseField(+ name="timestamp", nullable=False, description="When the interaction occurred (in UTC)."+ ),+ "type": StringDatabaseField(+ name="type",+ nullable=False,+ description="Interaction type, e.g. 'click', 'rageclick', 'mousemove', 'scrolldepth'.",+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/information_schema.py b/posthog/hogql/database/schema/information_schema.pyindex a1a5306bda1c..d0ef3c43bd27 100644--- a/posthog/hogql/database/schema/information_schema.py+++ b/posthog/hogql/database/schema/information_schema.py@@ -669,18 +669,40 @@ _DATA_TYPES: list[tuple[str, str]] = []-def _string_field(name: str, nullable: bool = False) -> StringDatabaseField:- return StringDatabaseField(name=name, nullable=nullable)+def _string_field(name: str, nullable: bool = False, description: Optional[str] = None) -> StringDatabaseField:+ return StringDatabaseField(name=name, nullable=nullable, description=description)class InformationSchemaTablesTable(LazyTable):+ description: str = (+ "SQL-standard catalog of every table, view, system table, and data warehouse table visible "+ "to the caller; one row per table. Start here to discover what is queryable."+ )fields: dict[str, FieldOrTable] = {- "table_catalog": _string_field("table_catalog", nullable=False),- "table_schema": _string_field("table_schema", nullable=False),- "table_name": _string_field("table_name", nullable=False),- "table_type": _string_field("table_type", nullable=False),- "description": _string_field("description", nullable=True),- "row_count": IntegerDatabaseField(name="row_count", nullable=True),+ "table_catalog": _string_field(+ "table_catalog",+ nullable=False,+ description="Table name (same as table_name); PostHog does not use a separate catalog identifier.",+ ),+ "table_schema": _string_field(+ "table_schema",+ nullable=False,+ description="Schema bucket the table sits in: 'public', 'system', 'information_schema', 'warehouse', or 'views'.",+ ),+ "table_name": _string_field("table_name", nullable=False, description="The table's name, used to query it."),+ "table_type": _string_field(+ "table_type",+ nullable=False,+ description="Origin of the table: 'posthog', 'system', 'information_schema', 'data_warehouse', or 'view'.",+ ),+ "description": _string_field(+ "description", nullable=True, description="Human/agent-facing description of what the table holds."+ ),+ "row_count": IntegerDatabaseField(+ name="row_count",+ nullable=True,+ description="Approximate row count; only populated for data warehouse tables and views, NULL otherwise.",+ ),}def lazy_select(self, table_to_add: LazyTableToAdd, context: "HogQLContext", node: Any) -> ast.SelectQuery:@@ -696,16 +718,44 @@ class InformationSchemaTablesTable(LazyTable):class InformationSchemaColumnsTable(LazyTable):+ description: str = (+ "SQL-standard catalog of every column on every visible table; one row per column. Filter by "+ "table_name to inspect a table's columns, their types, and descriptions."+ )fields: dict[str, FieldOrTable] = {- "table_schema": _string_field("table_schema", nullable=False),- "table_name": _string_field("table_name", nullable=False),- "column_name": _string_field("column_name", nullable=False),- "ordinal_position": IntegerDatabaseField(name="ordinal_position", nullable=False),- "data_type": _string_field("data_type", nullable=False),- "is_nullable": BooleanDatabaseField(name="is_nullable", nullable=False),- "is_array": BooleanDatabaseField(name="is_array", nullable=False),- "field_kind": _string_field("field_kind", nullable=False),- "description": _string_field("description", nullable=True),+ "table_schema": _string_field(+ "table_schema", nullable=False, description="Schema bucket the column's table belongs to."+ ),+ "table_name": _string_field(+ "table_name", nullable=False, description="Name of the table the column belongs to."+ ),+ "column_name": _string_field(+ "column_name",+ nullable=False,+ description="Column name; nested virtual-table columns appear as 'parent.child'.",+ ),+ "ordinal_position": IntegerDatabaseField(+ name="ordinal_position", nullable=False, description="1-based position of the column within its table."+ ),+ "data_type": _string_field(+ "data_type",+ nullable=False,+ description="HogQL data type, e.g. String, Integer, DateTime, JSON; see information_schema.data_types.",+ ),+ "is_nullable": BooleanDatabaseField(+ name="is_nullable", nullable=False, description="Whether the column can hold NULL values."+ ),+ "is_array": BooleanDatabaseField(+ name="is_array", nullable=False, description="Whether the column is an array type."+ ),+ "field_kind": _string_field(+ "field_kind",+ nullable=False,+ description="How the column is backed: 'column', 'expression' (computed), or 'virtual_table'.",+ ),+ "description": _string_field(+ "description", nullable=True, description="Human/agent-facing description of what the column holds."+ ),}def lazy_select(self, table_to_add: LazyTableToAdd, context: "HogQLContext", node: Any) -> ast.SelectQuery:@@ -721,13 +771,27 @@ class InformationSchemaColumnsTable(LazyTable):class InformationSchemaRelationshipsTable(LazyTable):+ description: str = (+ "Joinable relationships between tables (lazy joins and field traversers); one row per "+ "relationship. Use it to discover how to join from one table to another in HogQL."+ )fields: dict[str, FieldOrTable] = {- "source_table": _string_field("source_table", nullable=False),- "source_column": _string_field("source_column", nullable=False),- "target_table": _string_field("target_table", nullable=False),- "target_column": _string_field("target_column", nullable=True),- "relationship_kind": _string_field("relationship_kind", nullable=False),- "via": _string_field("via", nullable=True),+ "source_table": _string_field(+ "source_table", nullable=False, description="Table the relationship is defined on."+ ),+ "source_column": _string_field(+ "source_column", nullable=False, description="Column (or field path) on the source table that joins out."+ ),+ "target_table": _string_field("target_table", nullable=False, description="Table the relationship points to."),+ "target_column": _string_field(+ "target_column", nullable=True, description="Column (or field path) on the target table that is joined to."+ ),+ "relationship_kind": _string_field(+ "relationship_kind", nullable=False, description="Kind of relationship: 'lazy_join' or 'field_traverser'."+ ),+ "via": _string_field(+ "via", nullable=True, description="Internal resolver backing a lazy join, NULL for field traversers."+ ),}def lazy_select(self, table_to_add: LazyTableToAdd, context: "HogQLContext", node: Any) -> ast.SelectQuery:@@ -743,9 +807,15 @@ class InformationSchemaRelationshipsTable(LazyTable):class InformationSchemaDataTypesTable(LazyTable):+ description: str = (+ "Reference list of the HogQL data types reported in information_schema.columns, with a short "+ "explanation of each; one row per type."+ )fields: dict[str, FieldOrTable] = {- "type_name": _string_field("type_name", nullable=False),- "description": _string_field("description", nullable=False),+ "type_name": _string_field(+ "type_name", nullable=False, description="Type name as it appears in columns.data_type."+ ),+ "description": _string_field("description", nullable=False, description="What values of this type represent."),}def lazy_select(self, table_to_add: LazyTableToAdd, context: "HogQLContext", node: Any) -> ast.SelectQuery:diff --git a/posthog/hogql/database/schema/log_entries.py b/posthog/hogql/database/schema/log_entries.pyindex c62b05f89d01..a2772b4a03b8 100644--- a/posthog/hogql/database/schema/log_entries.py+++ b/posthog/hogql/database/schema/log_entries.py@@ -11,16 +11,33 @@ from posthog.hogql.database.models import (LOG_ENTRIES_FIELDS: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "log_source": StringDatabaseField(name="log_source", nullable=False),- "log_source_id": StringDatabaseField(name="log_source_id", nullable=False),- "instance_id": StringDatabaseField(name="instance_id", nullable=False),- "timestamp": DateTimeDatabaseField(name="timestamp", nullable=False),- "message": StringDatabaseField(name="message", nullable=False),- "level": StringDatabaseField(name="level", nullable=False),+ "log_source": StringDatabaseField(+ name="log_source",+ nullable=False,+ description="Origin of the log line, e.g. 'session_replay' (console logs) or 'batch_export'.",+ ),+ "log_source_id": StringDatabaseField(+ name="log_source_id",+ nullable=False,+ description="Identifier of the source entity that produced the log (e.g. the session or batch export id).",+ ),+ "instance_id": StringDatabaseField(+ name="instance_id",+ nullable=False,+ description="Identifier of the specific run/instance that emitted the log line.",+ ),+ "timestamp": DateTimeDatabaseField(name="timestamp", nullable=False, description="When the log line was emitted."),+ "message": StringDatabaseField(name="message", nullable=False, description="The log message text."),+ "level": StringDatabaseField(+ name="level", nullable=False, description="Log severity level, e.g. 'info', 'warn', 'error'."+ ),}class LogEntriesTable(Table):+ description: str = (+ "Console/diagnostic log lines emitted by plugins, batch exports, and session replay, filtered by `log_source`."+ )fields: dict[str, FieldOrTable] = LOG_ENTRIES_FIELDSdef to_printed_clickhouse(self, context):@@ -31,6 +48,7 @@ class LogEntriesTable(Table):class ReplayConsoleLogsLogEntriesTable(LazyTable):+ description: str = "Browser console log lines captured during session replay (`log_source` = 'session_replay')."fields: dict[str, FieldOrTable] = LOG_ENTRIES_FIELDSdef lazy_select(self, table_to_add: LazyTableToAdd, context, node):@@ -56,6 +74,7 @@ class ReplayConsoleLogsLogEntriesTable(LazyTable):class BatchExportLogEntriesTable(LazyTable):+ description: str = "Log lines emitted by batch export runs (`log_source` = 'batch_export')."fields: dict[str, FieldOrTable] = LOG_ENTRIES_FIELDSdef lazy_select(self, table_to_add: LazyTableToAdd, context, node):diff --git a/posthog/hogql/database/schema/logs.py b/posthog/hogql/database/schema/logs.pyindex 715a20bfbe90..554801f2e0f4 100644--- a/posthog/hogql/database/schema/logs.py+++ b/posthog/hogql/database/schema/logs.py@@ -16,27 +16,70 @@ HOGQL_MAX_BYTES_TO_READ_FOR_LOGS_USER_QUERIES = 50_000_000_000class LogsTable(Table):+ description: str = "OpenTelemetry-style log records ingested into the logs product, one row per log line."workload: Workload | None = Workload.LOGSfields: dict[str, FieldOrTable] = {- "uuid": StringDatabaseField(name="uuid", nullable=False),+ "uuid": StringDatabaseField(name="uuid", nullable=False, description="Unique identifier of this log record."),"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "trace_id": StringDatabaseField(name="trace_id", nullable=False),- "span_id": StringDatabaseField(name="span_id", nullable=False),- "message": StringDatabaseField(name="body", nullable=False),- "body": StringDatabaseField(name="body", nullable=False),- "attributes": MapStringDatabaseField(name="attributes", nullable=False),- "time_bucket": DateTimeDatabaseField(name="time_bucket", nullable=False),- "timestamp": DateTimeDatabaseField(name="timestamp", nullable=False),- "observed_timestamp": DateTimeDatabaseField(name="observed_timestamp", nullable=False),- "severity_text": StringDatabaseField(name="severity_text", nullable=False),- "severity_number": IntegerDatabaseField(name="severity_number", nullable=False),- "level": StringDatabaseField(name="level", nullable=False),- "resource_attributes": MapStringDatabaseField(name="resource_attributes", nullable=False),- "resource_fingerprint": IntegerDatabaseField(name="resource_fingerprint", nullable=False),- "instrumentation_scope": StringDatabaseField(name="instrumentation_scope", nullable=False),- "event_name": StringDatabaseField(name="event_name", nullable=False),- "service_name": StringDatabaseField(name="service_name", nullable=False),+ "trace_id": StringDatabaseField(+ name="trace_id",+ nullable=False,+ description="Trace this log belongs to; join to `trace_spans` on `trace_id`.",+ ),+ "span_id": StringDatabaseField(+ name="span_id", nullable=False, description="Span this log was emitted within; join to `trace_spans`."+ ),+ "message": StringDatabaseField(+ name="body", nullable=False, description="The log message text; alias of `body`."+ ),+ "body": StringDatabaseField(name="body", nullable=False, description="The raw log message text."),+ "attributes": MapStringDatabaseField(+ name="attributes", nullable=False, description="Per-record OpenTelemetry log attributes as a string map."+ ),+ "time_bucket": DateTimeDatabaseField(+ name="time_bucket", nullable=False, description="Coarse time bucket used for partitioning and filtering."+ ),+ "timestamp": DateTimeDatabaseField(+ name="timestamp", nullable=False, description="When the log event occurred (event timestamp)."+ ),+ "observed_timestamp": DateTimeDatabaseField(+ name="observed_timestamp",+ nullable=False,+ description="When the collector observed/ingested the log; differs from `timestamp`.",+ ),+ "severity_text": StringDatabaseField(+ name="severity_text", nullable=False, description="OpenTelemetry severity text, e.g. 'INFO', 'ERROR'."+ ),+ "severity_number": IntegerDatabaseField(+ name="severity_number",+ nullable=False,+ description="OpenTelemetry numeric severity (1-24, higher is more severe).",+ ),+ "level": StringDatabaseField(+ name="level", nullable=False, description="Normalized log level, e.g. 'info', 'warn', 'error'."+ ),+ "resource_attributes": MapStringDatabaseField(+ name="resource_attributes",+ nullable=False,+ description="OpenTelemetry resource attributes (the emitting service/host) as a string map.",+ ),+ "resource_fingerprint": IntegerDatabaseField(+ name="resource_fingerprint",+ nullable=False,+ description="Hash of the resource attributes, used to deduplicate/group resources.",+ ),+ "instrumentation_scope": StringDatabaseField(+ name="instrumentation_scope",+ nullable=False,+ description="OpenTelemetry instrumentation scope (library/module that emitted the log).",+ ),+ "event_name": StringDatabaseField(+ name="event_name", nullable=False, description="OpenTelemetry log event name, when set."+ ),+ "service_name": StringDatabaseField(+ name="service_name", nullable=False, description="Name of the service that emitted the log."+ ),# internal fields for query optimization"_part_starting_offset": IntegerDatabaseField(name="_part_starting_offset", nullable=True, hidden=True),"_part_offset": IntegerDatabaseField(name="_part_offset", nullable=True, hidden=True),@@ -52,16 +95,35 @@ class LogsTable(Table):class LogAttributesTable(Table):+ description: str = "Distinct log attribute key/value pairs with occurrence counts, used to power log attribute autocomplete and faceting."workload: Workload | None = Workload.LOGSfields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "time_bucket": DateTimeDatabaseField(name="time_bucket", nullable=False),- "attribute_key": StringDatabaseField(name="attribute_key", nullable=False),- "attribute_value": StringDatabaseField(name="attribute_value", nullable=False),- "attribute_type": StringDatabaseField(name="attribute_type", nullable=False),- "attribute_count": IntegerDatabaseField(name="attribute_count", nullable=False),- "resource_fingerprint": IntegerDatabaseField(name="resource_fingerprint", nullable=False),- "service_name": StringDatabaseField(name="service_name", nullable=False),+ "time_bucket": DateTimeDatabaseField(+ name="time_bucket",+ nullable=False,+ description="Coarse time bucket the attribute counts are aggregated over.",+ ),+ "attribute_key": StringDatabaseField(name="attribute_key", nullable=False, description="Log attribute name."),+ "attribute_value": StringDatabaseField(+ name="attribute_value", nullable=False, description="Observed value for the attribute key."+ ),+ "attribute_type": StringDatabaseField(+ name="attribute_type",+ nullable=False,+ description="Where the attribute came from (e.g. resource vs log attribute).",+ ),+ "attribute_count": IntegerDatabaseField(+ name="attribute_count", nullable=False, description="Number of logs with this key/value in the time bucket."+ ),+ "resource_fingerprint": IntegerDatabaseField(+ name="resource_fingerprint",+ nullable=False,+ description="Hash of the resource attributes the count is scoped to.",+ ),+ "service_name": StringDatabaseField(+ name="service_name", nullable=False, description="Service the attribute counts are scoped to."+ ),}def to_printed_clickhouse(self, context):@@ -78,11 +140,16 @@ class LogsKafkaMetricsTable(DANGEROUS_NoTeamIdCheckTable):This is so we can find out the overall lag per partition and filter live logs accordingly"""+ description: str = "Per-partition Kafka consumption metadata for the logs ingestion topic; not scoped to teams, used to track ingestion lag."workload: Workload | None = Workload.LOGSfields: dict[str, FieldOrTable] = {"_partition": IntegerDatabaseField(name="_partition", nullable=False),"_topic": StringDatabaseField(name="_topic", nullable=False),- "max_observed_timestamp": DateTimeDatabaseField(name="max_observed_timestamp", nullable=False),+ "max_observed_timestamp": DateTimeDatabaseField(+ name="max_observed_timestamp",+ nullable=False,+ description="Latest observed timestamp consumed from this partition; used to compute ingestion lag.",+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/marketing_conversions_preaggregated.py b/posthog/hogql/database/schema/marketing_conversions_preaggregated.pyindex 393640a55567..a4236ceada2e 100644--- a/posthog/hogql/database/schema/marketing_conversions_preaggregated.py+++ b/posthog/hogql/database/schema/marketing_conversions_preaggregated.py@@ -20,21 +20,40 @@ from posthog.clickhouse.preaggregation.marketing_conversions_sql import (def _build_fields() -> dict[str, FieldOrTable]:fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id"),- "job_id": StringDatabaseField(name="job_id"),- "person_id": StringDatabaseField(name="person_id"),- "conversion_timestamp": DateTimeDatabaseField(name="conversion_timestamp"),- "conversion_math_value": FloatDatabaseField(name="conversion_math_value"),- "session_id": StringDatabaseField(name="session_id"),+ "job_id": StringDatabaseField(+ name="job_id", description="Identifier of the preaggregation job that produced this row."+ ),+ "person_id": StringDatabaseField(name="person_id", description="Person who converted; join to `persons`."),+ "conversion_timestamp": DateTimeDatabaseField(+ name="conversion_timestamp", description="When the conversion event occurred (UTC)."+ ),+ "conversion_math_value": FloatDatabaseField(+ name="conversion_math_value",+ description="Numeric value of the conversion under the goal's math aggregation (e.g. summed property or count).",+ ),+ "session_id": StringDatabaseField(+ name="session_id", description="Session in which the conversion occurred; join to `sessions`."+ ),}for tracked_name in MARKETING_CONVERSIONS_TRACKED_FIELD_NAMES:col = f"{tracked_name}_name"- fields[col] = StringDatabaseField(name=col)- fields["computed_at"] = DateTimeDatabaseField(name="computed_at")- fields["expires_at"] = DateDatabaseField(name="expires_at")+ fields[col] = StringDatabaseField(+ name=col, description=f"Value of the '{tracked_name}' marketing attribute for the converting session."+ )+ fields["computed_at"] = DateTimeDatabaseField(+ name="computed_at", description="When this preaggregated row was computed; also the ReplacingMergeTree version."+ )+ fields["expires_at"] = DateDatabaseField(+ name="expires_at", description="Date when this row expires and is dropped via TTL."+ )return fieldsclass MarketingConversionsPreaggregatedTable(Table):+ description: str = (+ "Internal preaggregated table of marketing conversion events, one row per conversion with the "+ "tracked marketing attributes of the converting session. Powers marketing analytics conversion reporting."+ )top_level_settings: HogQLQuerySettings | None = Field(default_factory=lambda: HogQLQuerySettings(load_balancing="in_order"))diff --git a/posthog/hogql/database/schema/marketing_costs_preaggregated.py b/posthog/hogql/database/schema/marketing_costs_preaggregated.pyindex 632debd04928..768c31561919 100644--- a/posthog/hogql/database/schema/marketing_costs_preaggregated.py+++ b/posthog/hogql/database/schema/marketing_costs_preaggregated.py@@ -15,31 +15,62 @@ from posthog.clickhouse.preaggregation.marketing_costs_sql import DISTRIBUTED_MAclass MarketingCostsPreaggregatedTable(Table):+ description: str = (+ "Internal preaggregated table of marketing ad-spend cost rows (per source, campaign, ad group, ad, day) "+ "materialized from external data-warehouse tables into native ClickHouse for the marketing analytics dashboard."+ )top_level_settings: HogQLQuerySettings | None = Field(default_factory=lambda: HogQLQuerySettings(load_balancing="in_order"))fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id"),- "job_id": StringDatabaseField(name="job_id"),- "source_id": StringDatabaseField(name="source_id"),- "source_name": StringDatabaseField(name="source_name"),- "grain": StringDatabaseField(name="grain"),- "match_key": StringDatabaseField(name="match_key"),- "campaign_id": StringDatabaseField(name="campaign_id"),- "campaign_name": StringDatabaseField(name="campaign_name"),- "ad_group_id": StringDatabaseField(name="ad_group_id"),- "ad_group_name": StringDatabaseField(name="ad_group_name"),- "ad_id": StringDatabaseField(name="ad_id"),- "ad_name": StringDatabaseField(name="ad_name"),- "cost_date": DateDatabaseField(name="cost_date"),- "cost": FloatDatabaseField(name="cost"),- "clicks": FloatDatabaseField(name="clicks"),- "impressions": FloatDatabaseField(name="impressions"),- "reported_conversions": FloatDatabaseField(name="reported_conversions"),- "reported_conversion_value": FloatDatabaseField(name="reported_conversion_value"),- "computed_at": DateTimeDatabaseField(name="computed_at"),- "expires_at": DateDatabaseField(name="expires_at"),+ "job_id": StringDatabaseField(+ name="job_id", description="Identifier of the preaggregation job that produced this row."+ ),+ "source_id": StringDatabaseField(+ name="source_id",+ description="Identifier of the marketing source (data warehouse source) the cost came from.",+ ),+ "source_name": StringDatabaseField(+ name="source_name", description="Human-readable name of the marketing source (e.g. 'Google Ads')."+ ),+ "grain": StringDatabaseField(+ name="grain", description="Granularity level of this cost row (e.g. campaign, ad_group, or ad)."+ ),+ "match_key": StringDatabaseField(+ name="match_key", description="Key used to match cost rows against touchpoints/conversions for attribution."+ ),+ "campaign_id": StringDatabaseField(name="campaign_id", description="Source campaign identifier."),+ "campaign_name": StringDatabaseField(name="campaign_name", description="Source campaign name."),+ "ad_group_id": StringDatabaseField(name="ad_group_id", description="Source ad group identifier."),+ "ad_group_name": StringDatabaseField(name="ad_group_name", description="Source ad group name."),+ "ad_id": StringDatabaseField(name="ad_id", description="Source ad identifier."),+ "ad_name": StringDatabaseField(name="ad_name", description="Source ad name."),+ "cost_date": DateDatabaseField(name="cost_date", description="Date the cost was incurred."),+ "cost": FloatDatabaseField(+ name="cost", description="Ad spend for this row, in the source's reporting currency."+ ),+ "clicks": FloatDatabaseField(+ name="clicks", description="Number of clicks reported by the source for this row."+ ),+ "impressions": FloatDatabaseField(+ name="impressions", description="Number of impressions reported by the source for this row."+ ),+ "reported_conversions": FloatDatabaseField(+ name="reported_conversions",+ description="Conversions reported by the ad source itself (not PostHog-attributed).",+ ),+ "reported_conversion_value": FloatDatabaseField(+ name="reported_conversion_value", description="Conversion value reported by the ad source itself."+ ),+ "computed_at": DateTimeDatabaseField(+ name="computed_at",+ description="When this preaggregated row was computed; also the ReplacingMergeTree version.",+ ),+ "expires_at": DateDatabaseField(+ name="expires_at", description="Date when this row expires and is dropped via TTL."+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/marketing_touchpoints_preaggregated.py b/posthog/hogql/database/schema/marketing_touchpoints_preaggregated.pyindex cadc73578ff9..789255a02d8b 100644--- a/posthog/hogql/database/schema/marketing_touchpoints_preaggregated.py+++ b/posthog/hogql/database/schema/marketing_touchpoints_preaggregated.py@@ -19,19 +19,35 @@ from posthog.clickhouse.preaggregation.marketing_touchpoints_sql import (def _build_fields() -> dict[str, FieldOrTable]:fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id"),- "job_id": StringDatabaseField(name="job_id"),- "person_id": StringDatabaseField(name="person_id"),- "touchpoint_timestamp": DateTimeDatabaseField(name="touchpoint_timestamp"),+ "job_id": StringDatabaseField(+ name="job_id", description="Identifier of the preaggregation job that produced this row."+ ),+ "person_id": StringDatabaseField(+ name="person_id", description="Person who experienced the touchpoint; join to `persons`."+ ),+ "touchpoint_timestamp": DateTimeDatabaseField(+ name="touchpoint_timestamp", description="When the marketing touchpoint occurred (UTC)."+ ),}for tracked_name in MARKETING_TOUCHPOINTS_TRACKED_FIELD_NAMES:col = f"{tracked_name}_name"- fields[col] = StringDatabaseField(name=col)- fields["computed_at"] = DateTimeDatabaseField(name="computed_at")- fields["expires_at"] = DateDatabaseField(name="expires_at")+ fields[col] = StringDatabaseField(+ name=col, description=f"Value of the '{tracked_name}' marketing attribute for this touchpoint."+ )+ fields["computed_at"] = DateTimeDatabaseField(+ name="computed_at", description="When this preaggregated row was computed; also the ReplacingMergeTree version."+ )+ fields["expires_at"] = DateDatabaseField(+ name="expires_at", description="Date when this row expires and is dropped via TTL."+ )return fieldsclass MarketingTouchpointsPreaggregatedTable(Table):+ description: str = (+ "Internal preaggregated table of marketing touchpoints (one row per person interaction with a marketing "+ "channel), carrying the tracked marketing attributes. Feeds conversion attribution in marketing analytics."+ )top_level_settings: HogQLQuerySettings | None = Field(default_factory=lambda: HogQLQuerySettings(load_balancing="in_order"))diff --git a/posthog/hogql/database/schema/metrics.py b/posthog/hogql/database/schema/metrics.pyindex 9ec2bf42b3b9..89ed6ff4e102 100644--- a/posthog/hogql/database/schema/metrics.py+++ b/posthog/hogql/database/schema/metrics.py@@ -18,30 +18,81 @@ HOGQL_MAX_BYTES_TO_READ_FOR_METRICS_USER_QUERIES = 50_000_000_000class MetricsTable(Table):+ description: str = "OpenTelemetry metric data points (gauges, sums, histograms), one row per data point."workload: Workload | None = Workload.LOGS # reuse LOGS workload for nowfields: dict[str, FieldOrTable] = {- "uuid": StringDatabaseField(name="uuid", nullable=False),+ "uuid": StringDatabaseField(+ name="uuid", nullable=False, description="Unique identifier of this data point row."+ ),"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "trace_id": StringDatabaseField(name="trace_id", nullable=False),- "span_id": StringDatabaseField(name="span_id", nullable=False),- "time_bucket": DateTimeDatabaseField(name="time_bucket", nullable=False),- "timestamp": DateTimeDatabaseField(name="timestamp", nullable=False),- "observed_timestamp": DateTimeDatabaseField(name="observed_timestamp", nullable=False),- "service_name": StringDatabaseField(name="service_name", nullable=False),- "metric_name": StringDatabaseField(name="metric_name", nullable=False),- "metric_type": StringDatabaseField(name="metric_type", nullable=False),- "value": FloatDatabaseField(name="value", nullable=False),- "count": IntegerDatabaseField(name="count", nullable=False),- "histogram_bounds": StringJSONDatabaseField(name="histogram_bounds", nullable=False),- "histogram_counts": StringJSONDatabaseField(name="histogram_counts", nullable=False),- "unit": StringDatabaseField(name="unit", nullable=False),- "aggregation_temporality": StringDatabaseField(name="aggregation_temporality", nullable=False),- "is_monotonic": BooleanDatabaseField(name="is_monotonic", nullable=False),- "resource_attributes": MapStringDatabaseField(name="resource_attributes", nullable=False),- "resource_fingerprint": IntegerDatabaseField(name="resource_fingerprint", nullable=False),- "instrumentation_scope": StringDatabaseField(name="instrumentation_scope", nullable=False),- "attributes": MapStringDatabaseField(name="attributes", nullable=False),+ "trace_id": StringDatabaseField(+ name="trace_id", nullable=False, description="Trace this metric exemplar is associated with, if any."+ ),+ "span_id": StringDatabaseField(+ name="span_id", nullable=False, description="Span this metric exemplar is associated with, if any."+ ),+ "time_bucket": DateTimeDatabaseField(+ name="time_bucket", nullable=False, description="Coarse time bucket used for partitioning and filtering."+ ),+ "timestamp": DateTimeDatabaseField(+ name="timestamp", nullable=False, description="When the metric data point was recorded."+ ),+ "observed_timestamp": DateTimeDatabaseField(+ name="observed_timestamp",+ nullable=False,+ description="When the collector observed/ingested the data point.",+ ),+ "service_name": StringDatabaseField(+ name="service_name", nullable=False, description="Name of the service that emitted the metric."+ ),+ "metric_name": StringDatabaseField(name="metric_name", nullable=False, description="Name of the metric."),+ "metric_type": StringDatabaseField(+ name="metric_type",+ nullable=False,+ description="OpenTelemetry metric type, e.g. 'gauge', 'sum', 'histogram'.",+ ),+ "value": FloatDatabaseField(+ name="value", nullable=False, description="Numeric value of the data point (for gauge/sum metrics)."+ ),+ "count": IntegerDatabaseField(+ name="count", nullable=False, description="Total count of observations (for histogram metrics)."+ ),+ "histogram_bounds": StringJSONDatabaseField(+ name="histogram_bounds", nullable=False, description="JSON array of histogram bucket boundaries."+ ),+ "histogram_counts": StringJSONDatabaseField(+ name="histogram_counts",+ nullable=False,+ description="JSON array of per-bucket counts, aligned with `histogram_bounds`.",+ ),+ "unit": StringDatabaseField(+ name="unit", nullable=False, description="Unit of the metric value, e.g. 'ms', 'By'."+ ),+ "aggregation_temporality": StringDatabaseField(+ name="aggregation_temporality",+ nullable=False,+ description="OpenTelemetry temporality, e.g. 'delta' or 'cumulative'.",+ ),+ "is_monotonic": BooleanDatabaseField(+ name="is_monotonic", nullable=False, description="True if the sum metric only increases."+ ),+ "resource_attributes": MapStringDatabaseField(+ name="resource_attributes", nullable=False, description="OpenTelemetry resource attributes as a string map."+ ),+ "resource_fingerprint": IntegerDatabaseField(+ name="resource_fingerprint",+ nullable=False,+ description="Hash of the resource attributes, used to group resources.",+ ),+ "instrumentation_scope": StringDatabaseField(+ name="instrumentation_scope",+ nullable=False,+ description="Instrumentation scope (library/module) that emitted the metric.",+ ),+ "attributes": MapStringDatabaseField(+ name="attributes", nullable=False, description="Per-data-point OpenTelemetry attributes as a string map."+ ),}def to_printed_clickhouse(self, context):@@ -52,17 +103,40 @@ class MetricsTable(Table):class MetricAttributesTable(Table):+ description: str = "Distinct metric attribute key/value pairs with occurrence counts, used to power metric attribute autocomplete and faceting."workload: Workload | None = Workload.LOGSfields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "time_bucket": DateTimeDatabaseField(name="time_bucket", nullable=False),- "attribute_key": StringDatabaseField(name="attribute_key", nullable=False),- "attribute_value": StringDatabaseField(name="attribute_value", nullable=False),- "attribute_type": StringDatabaseField(name="attribute_type", nullable=False),- "attribute_count": IntegerDatabaseField(name="attribute_count", nullable=False),- "resource_fingerprint": IntegerDatabaseField(name="resource_fingerprint", nullable=False),- "service_name": StringDatabaseField(name="service_name", nullable=False),+ "time_bucket": DateTimeDatabaseField(+ name="time_bucket",+ nullable=False,+ description="Coarse time bucket the attribute counts are aggregated over.",+ ),+ "attribute_key": StringDatabaseField(+ name="attribute_key", nullable=False, description="Metric attribute name."+ ),+ "attribute_value": StringDatabaseField(+ name="attribute_value", nullable=False, description="Observed value for the attribute key."+ ),+ "attribute_type": StringDatabaseField(+ name="attribute_type",+ nullable=False,+ description="Where the attribute came from (e.g. resource vs metric attribute).",+ ),+ "attribute_count": IntegerDatabaseField(+ name="attribute_count",+ nullable=False,+ description="Number of data points with this key/value in the time bucket.",+ ),+ "resource_fingerprint": IntegerDatabaseField(+ name="resource_fingerprint",+ nullable=False,+ description="Hash of the resource attributes the count is scoped to.",+ ),+ "service_name": StringDatabaseField(+ name="service_name", nullable=False, description="Service the attribute counts are scoped to."+ ),}def to_printed_clickhouse(self, context):@@ -79,12 +153,17 @@ class MetricsKafkaMetricsTable(DANGEROUS_NoTeamIdCheckTable):This is so we can find out the overall lag per partition and filter live metrics accordingly"""+ description: str = "Per-partition Kafka consumption metadata for the metrics ingestion topic; not scoped to teams, used to track ingestion lag."workload: Workload | None = Workload.LOGSfields: dict[str, FieldOrTable] = {"_partition": IntegerDatabaseField(name="_partition", nullable=False),"_topic": StringDatabaseField(name="_topic", nullable=False),- "max_observed_timestamp": DateTimeDatabaseField(name="max_observed_timestamp", nullable=False),+ "max_observed_timestamp": DateTimeDatabaseField(+ name="max_observed_timestamp",+ nullable=False,+ description="Latest observed timestamp consumed from this partition; used to compute ingestion lag.",+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/numbers.py b/posthog/hogql/database/schema/numbers.pyindex 18de985c08f4..58abe989ac87 100644--- a/posthog/hogql/database/schema/numbers.py+++ b/posthog/hogql/database/schema/numbers.py@@ -8,11 +8,16 @@ from posthog.hogql.database.models import ()NUMBERS_TABLE_FIELDS: dict[str, FieldOrTable] = {- "number": IntegerDatabaseField(name="number", nullable=False),+ "number": IntegerDatabaseField(name="number", nullable=False, description="The generated integer value."),}class NumbersTable(FunctionCallTable, DANGEROUS_NoTeamIdCheckTable):+ description: str = (+ "Utility table function generating a sequence of consecutive integers. "+ "Call as numbers(N) for 0..N-1, or numbers(start, count) for `count` integers starting at `start`. "+ "Often used to generate rows for joins or date series."+ )fields: dict[str, FieldOrTable] = NUMBERS_TABLE_FIELDSname: str = "numbers"diff --git a/posthog/hogql/database/schema/person_distinct_id_overrides.py b/posthog/hogql/database/schema/person_distinct_id_overrides.pyindex 25c812398667..7190a10cc0ab 100644--- a/posthog/hogql/database/schema/person_distinct_id_overrides.py+++ b/posthog/hogql/database/schema/person_distinct_id_overrides.py@@ -18,8 +18,16 @@ from posthog.hogql.errors import ResolutionErrorPERSON_DISTINCT_ID_OVERRIDES_FIELDS: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "distinct_id": StringDatabaseField(name="distinct_id", nullable=False),- "person_id": StringDatabaseField(name="person_id", nullable=False),+ "distinct_id": StringDatabaseField(+ name="distinct_id",+ nullable=False,+ description="Distinct_id whose person mapping was overridden (e.g. after an identify or merge).",+ ),+ "person_id": StringDatabaseField(+ name="person_id",+ nullable=False,+ description="Corrected person this distinct_id now resolves to; matches `persons.id`.",+ ),"person": LazyJoin(from_field=["person_id"],join_table="persons",@@ -67,6 +75,11 @@ def join_with_person_distinct_id_overrides_table(class RawPersonDistinctIdOverridesTable(Table):+ description: str = (+ "Raw, un-deduplicated distinct_id-to-person override rows (one per version). Query "+ "`person_distinct_id_overrides` instead unless you need to resolve the latest version yourself via "+ "`is_deleted`/`version`."+ )fields: dict[str, FieldOrTable] = {**PERSON_DISTINCT_ID_OVERRIDES_FIELDS,"is_deleted": BooleanDatabaseField(name="is_deleted", nullable=False),@@ -81,6 +94,10 @@ class RawPersonDistinctIdOverridesTable(Table):class PersonDistinctIdOverridesTable(LazyTable):+ description: str = (+ "Records distinct IDs whose person mapping was corrected after ingestion (e.g. identify or person merges). "+ "One row per overridden distinct_id; used to remap events to the right person at query time."+ )fields: dict[str, FieldOrTable] = PERSON_DISTINCT_ID_OVERRIDES_FIELDSdef lazy_select(diff --git a/posthog/hogql/database/schema/person_distinct_ids.py b/posthog/hogql/database/schema/person_distinct_ids.pyindex 353c988b3462..6f57757ae091 100644--- a/posthog/hogql/database/schema/person_distinct_ids.py+++ b/posthog/hogql/database/schema/person_distinct_ids.py@@ -18,8 +18,16 @@ from posthog.hogql.errors import ResolutionErrorPERSON_DISTINCT_IDS_FIELDS: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "distinct_id": StringDatabaseField(name="distinct_id", nullable=False),- "person_id": StringDatabaseField(name="person_id", nullable=False),+ "distinct_id": StringDatabaseField(+ name="distinct_id",+ nullable=False,+ description="Client-side distinct_id sent with events; multiple distinct_ids can map to one person.",+ ),+ "person_id": StringDatabaseField(+ name="person_id",+ nullable=False,+ description="Resolved person this distinct_id belongs to; matches `persons.id`.",+ ),"person": LazyJoin(from_field=["person_id"],join_table="persons",@@ -67,6 +75,10 @@ def join_with_person_distinct_ids_table(class RawPersonDistinctIdsTable(Table):+ description: str = (+ "Raw, un-deduplicated distinct_id-to-person mappings (one per version). Query `person_distinct_ids` "+ "instead unless you need to resolve the latest version yourself via `is_deleted`/`version`."+ )fields: dict[str, FieldOrTable] = {**PERSON_DISTINCT_IDS_FIELDS,"is_deleted": BooleanDatabaseField(name="is_deleted", nullable=False),@@ -81,6 +93,10 @@ class RawPersonDistinctIdsTable(Table):class PersonDistinctIdsTable(LazyTable):+ description: str = (+ "Maps client-side distinct IDs to resolved person IDs. One row per distinct_id; "+ "join to `persons` via the `person` field or `person_id`."+ )fields: dict[str, FieldOrTable] = PERSON_DISTINCT_IDS_FIELDSdef lazy_select(self, table_to_add: LazyTableToAdd, context, node):diff --git a/posthog/hogql/database/schema/persons.py b/posthog/hogql/database/schema/persons.pyindex 96efbc959a3e..ef3aa5096d2a 100644--- a/posthog/hogql/database/schema/persons.py+++ b/posthog/hogql/database/schema/persons.py@@ -294,6 +294,10 @@ def join_with_persons_table(class RawPersonsTable(Table):+ description: str = (+ "Raw, un-deduplicated persons rows (one per version). Query `persons` instead unless you need to "+ "resolve the latest version yourself via `is_deleted`/`version`."+ )fields: dict[str, FieldOrTable] = {**PERSONS_FIELDS,"is_deleted": BooleanDatabaseField(name="is_deleted", nullable=False),diff --git a/posthog/hogql/database/schema/persons_pdi.py b/posthog/hogql/database/schema/persons_pdi.pyindex 879b9b154cc2..19eee1eefe36 100644--- a/posthog/hogql/database/schema/persons_pdi.py+++ b/posthog/hogql/database/schema/persons_pdi.py@@ -86,10 +86,22 @@ def persons_pdi_join(# :NOTE: We already have person_distinct_ids.py, which most tables link to. This persons_pdi.py is a hack to# make "select persons.pdi.distinct_id from persons" work while avoiding circular imports. Don't use directly.class PersonsPDITable(LazyTable):+ description: str = (+ "Internal helper mapping distinct IDs to person IDs, used only to resolve `persons.pdi.distinct_id`. "+ "Don't query directly; use `person_distinct_ids` instead."+ )fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "distinct_id": StringDatabaseField(name="distinct_id", nullable=False),- "person_id": StringDatabaseField(name="person_id", nullable=False),+ "distinct_id": StringDatabaseField(+ name="distinct_id",+ nullable=False,+ description="Client-side distinct_id sent with events; maps to a single person_id.",+ ),+ "person_id": StringDatabaseField(+ name="person_id",+ nullable=False,+ description="Resolved person this distinct_id belongs to; matches `persons.id`.",+ ),}def lazy_select(self, table_to_add: LazyTableToAdd, context, node):diff --git a/posthog/hogql/database/schema/persons_revenue_analytics.py b/posthog/hogql/database/schema/persons_revenue_analytics.pyindex f1d7ed686474..165bdf3b0468 100644--- a/posthog/hogql/database/schema/persons_revenue_analytics.py+++ b/posthog/hogql/database/schema/persons_revenue_analytics.py@@ -23,9 +23,19 @@ ZERO_DECIMAL = ast.Call(FIELDS: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id"),- "person_id": StringDatabaseField(name="person_id"),- "revenue": DecimalDatabaseField(name="revenue", nullable=False),- "mrr": DecimalDatabaseField(name="mrr", nullable=False),+ "person_id": StringDatabaseField(+ name="person_id", description="Person these revenue figures are aggregated for; join target for `persons.id`."+ ),+ "revenue": DecimalDatabaseField(+ name="revenue",+ nullable=False,+ description="Total revenue attributed to the person, summed across all their customers, in the project's base currency.",+ ),+ "mrr": DecimalDatabaseField(+ name="mrr",+ nullable=False,+ description="Monthly recurring revenue attributed to the person, summed across all their customers, in the project's base currency.",+ ),}@@ -172,6 +182,10 @@ def _select_from_persons_revenue_analytics_table(context: HogQLContext) -> ast.Sclass PersonsRevenueAnalyticsTable(LazyTable):+ description: str = (+ "Revenue and MRR aggregated per person from the revenue analytics views. "+ "One row per person; reachable from persons via the `revenue_analytics` join."+ )fields: dict[str, FieldOrTable] = FIELDSdef lazy_select(diff --git a/posthog/hogql/database/schema/pg_embeddings.py b/posthog/hogql/database/schema/pg_embeddings.pyindex b768e2077757..59867fca13e2 100644--- a/posthog/hogql/database/schema/pg_embeddings.py+++ b/posthog/hogql/database/schema/pg_embeddings.py@@ -10,15 +10,34 @@ from posthog.hogql.database.models import (class PgEmbeddingsTable(Table):+ description: str = "General-purpose vector embeddings keyed by domain and id, used for semantic search."fields: dict[str, FieldOrTable] = {- "domain": StringDatabaseField(name="domain", nullable=False),+ "domain": StringDatabaseField(+ name="domain", nullable=False, description="Namespace grouping embeddings of the same kind."+ ),"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "id": StringDatabaseField(name="id", nullable=False),- "vector": FloatArrayDatabaseField(name="vector", nullable=False),- "text": StringDatabaseField(name="text", nullable=False),- "properties": StringJSONDatabaseField(name="properties", nullable=False),- "timestamp": DateTimeDatabaseField(name="timestamp", nullable=False),- "is_deleted": IntegerDatabaseField(name="is_deleted", nullable=False),+ "id": StringDatabaseField(+ name="id", nullable=False, description="Identifier of the embedded item within its domain."+ ),+ "vector": FloatArrayDatabaseField(+ name="vector",+ nullable=False,+ description="The embedding vector; compare with `cosineDistance`/`L2Distance` for semantic search.",+ ),+ "text": StringDatabaseField(name="text", nullable=False, description="The text content that was embedded."),+ "properties": StringJSONDatabaseField(+ name="properties", nullable=False, description="JSON metadata associated with the embedded item."+ ),+ "timestamp": DateTimeDatabaseField(+ name="timestamp",+ nullable=False,+ description="When the embedding was written; also the ReplacingMergeTree version.",+ ),+ "is_deleted": IntegerDatabaseField(+ name="is_deleted",+ nullable=False,+ description="Soft-delete marker (1 if deleted); used for ReplacingMergeTree dedup.",+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/preaggregation_results.py b/posthog/hogql/database/schema/preaggregation_results.pyindex ddcc2e09afa7..5a466b2c631a 100644--- a/posthog/hogql/database/schema/preaggregation_results.py+++ b/posthog/hogql/database/schema/preaggregation_results.py@@ -20,17 +20,30 @@ class PreaggregationResultsTable(Table):Used for on-demand preaggregation of queries like uniqExact(person_id) GROUP BY day."""+ description: str = (+ "Internal table holding on-demand preaggregated query results (e.g. uniqExact(person_id) grouped by day), "+ "stored as aggregate-function state for cheap re-querying."+ )top_level_settings: HogQLQuerySettings | None = Field(default_factory=lambda: HogQLQuerySettings(load_balancing="in_order"))fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id"),- "job_id": StringDatabaseField(name="job_id"),- "time_window_start": DateTimeDatabaseField(name="time_window_start"),- "breakdown_value": StringArrayDatabaseField(name="breakdown_value"),+ "job_id": StringDatabaseField(+ name="job_id", description="Identifier of the preaggregation job that produced this row."+ ),+ "time_window_start": DateTimeDatabaseField(+ name="time_window_start", description="Start of the time bucket this aggregate covers (UTC)."+ ),+ "breakdown_value": StringArrayDatabaseField(+ name="breakdown_value", description="Breakdown dimension values for this aggregated bucket."+ ),# Aggregate state column - using generic DatabaseField since it's an AggregateFunction type- "uniq_exact_state": DatabaseField(name="uniq_exact_state"),+ "uniq_exact_state": DatabaseField(+ name="uniq_exact_state",+ description="AggregateFunction state for uniqExact; finalize with uniqExactMerge() to get the exact distinct count.",+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/precalculated_events.py b/posthog/hogql/database/schema/precalculated_events.pyindex 7b5317b790e0..ca7ed4277734 100644--- a/posthog/hogql/database/schema/precalculated_events.py+++ b/posthog/hogql/database/schema/precalculated_events.py@@ -12,14 +12,38 @@ from posthog.hogql.database.models import (class PrecalculatedEventsTable(Table):"""Table for precalculated behavioral events populated by CdpRealtimeCohortsConsumer."""+ description: str = (+ "Internal cache of behavioral matches used by realtime cohort calculation: records that a person "+ "satisfied a cohort behavioral condition on a given date. Populated by the realtime cohorts consumer; "+ "not a general analytics table."+ )+fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "distinct_id": StringDatabaseField(name="distinct_id", nullable=False),- "person_id": UUIDDatabaseField(name="person_id", nullable=False),- "condition": StringDatabaseField(name="condition", nullable=False),- "date": DateDatabaseField(name="date", nullable=False),- "uuid": UUIDDatabaseField(name="uuid", nullable=False),- "source": StringDatabaseField(name="source", nullable=False),+ "distinct_id": StringDatabaseField(+ name="distinct_id", nullable=False, description="Distinct ID that triggered the matching behavioral event."+ ),+ "person_id": UUIDDatabaseField(+ name="person_id",+ nullable=False,+ description="Person the matching event is attributed to; join to `persons.id`.",+ ),+ "condition": StringDatabaseField(+ name="condition",+ nullable=False,+ description="Identifier of the cohort behavioral condition that was matched.",+ ),+ "date": DateDatabaseField(+ name="date", nullable=False, description="Date on which the behavioral condition was matched."+ ),+ "uuid": UUIDDatabaseField(+ name="uuid", nullable=False, description="UUID of the underlying event that produced this match."+ ),+ "source": StringDatabaseField(+ name="source",+ nullable=False,+ description="Origin of this precalculated row (e.g. realtime ingestion vs backfill).",+ ),"_timestamp": DateTimeDatabaseField(name="_timestamp", nullable=False),"_partition": IntegerDatabaseField(name="_partition", nullable=False),"_offset": IntegerDatabaseField(name="_offset", nullable=False),diff --git a/posthog/hogql/database/schema/precalculated_person_properties.py b/posthog/hogql/database/schema/precalculated_person_properties.pyindex 6ba9a7d4b015..2576a47a29aa 100644--- a/posthog/hogql/database/schema/precalculated_person_properties.py+++ b/posthog/hogql/database/schema/precalculated_person_properties.py@@ -12,13 +12,37 @@ from posthog.hogql.database.models import (class PrecalculatedPersonPropertiesTable(Table):"""Table for precalculated person properties evaluations populated by CdpRealtimeCohortsConsumer."""+ description: str = (+ "Internal cache of person-property condition evaluations used by realtime cohort calculation: "+ "whether a person matched a cohort's property condition. Populated by the realtime cohorts consumer; "+ "not a general analytics table."+ )+fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "distinct_id": StringDatabaseField(name="distinct_id", nullable=False),- "person_id": UUIDDatabaseField(name="person_id", nullable=False),- "condition": StringDatabaseField(name="condition", nullable=False),- "matches": BooleanDatabaseField(name="matches", nullable=False),- "source": StringDatabaseField(name="source", nullable=False),+ "distinct_id": StringDatabaseField(+ name="distinct_id",+ nullable=False,+ description="Distinct ID for which the property condition was evaluated.",+ ),+ "person_id": UUIDDatabaseField(+ name="person_id",+ nullable=False,+ description="Person the evaluation is attributed to; join to `persons.id`.",+ ),+ "condition": StringDatabaseField(+ name="condition",+ nullable=False,+ description="Identifier of the cohort person-property condition that was evaluated.",+ ),+ "matches": BooleanDatabaseField(+ name="matches", nullable=False, description="True if the person satisfied the property condition."+ ),+ "source": StringDatabaseField(+ name="source",+ nullable=False,+ description="Origin of this precalculated row (e.g. realtime ingestion vs backfill).",+ ),"_timestamp": DateTimeDatabaseField(name="_timestamp", nullable=False),"_offset": IntegerDatabaseField(name="_offset", nullable=False),}diff --git a/posthog/hogql/database/schema/query_log_archive.py b/posthog/hogql/database/schema/query_log_archive.pyindex 28b615a7c6f7..6c028e705dfd 100644--- a/posthog/hogql/database/schema/query_log_archive.py+++ b/posthog/hogql/database/schema/query_log_archive.py@@ -15,38 +15,104 @@ from posthog.hogql.database.models import ()QUERY_LOG_ARCHIVE_FIELDS: dict[str, FieldOrTable] = {- "event_date": DateDatabaseField(name="event_date", nullable=False),- "event_time": DateTimeDatabaseField(name="event_time", nullable=False),- "query_id": StringDatabaseField(name="lc_client_query_id", nullable=False),- "endpoint": StringDatabaseField(name="lc_id", nullable=False),- "query": StringDatabaseField(name="lc_query__query", nullable=False),- "query_start_time": DateTimeDatabaseField(name="query_start_time", nullable=False),- "query_duration_ms": IntegerDatabaseField(name="query_duration_ms", nullable=False),- "name": StringDatabaseField(name="lc_request_name", nullable=False),- "created_by": IntegerDatabaseField(name="lc_user_id", nullable=False),- "read_rows": IntegerDatabaseField(name="read_rows", nullable=False),- "read_bytes": IntegerDatabaseField(name="read_bytes", nullable=False),- "result_rows": IntegerDatabaseField(name="result_rows", nullable=False),- "result_bytes": IntegerDatabaseField(name="result_bytes", nullable=False),- "memory_usage": IntegerDatabaseField(name="memory_usage", nullable=False),- "status": StringDatabaseField(name="type", nullable=False),- "exception_code": IntegerDatabaseField(name="exception_code", nullable=False),- "exception_name": StringDatabaseField(name="exception_name", nullable=False),- "is_personal_api_key_request": BooleanDatabaseField(name="is_personal_api_key_request", nullable=False),- "api_key_label": StringDatabaseField(name="lc_api_key_label", nullable=False),- "api_key_mask": StringDatabaseField(name="lc_api_key_mask", nullable=False),- "cpu_microseconds": IntegerDatabaseField(name="ProfileEvents_OSCPUVirtualTimeMicroseconds", nullable=False),- "RealTimeMicroseconds": IntegerDatabaseField(name="ProfileEvents_RealTimeMicroseconds", nullable=False),- "S3ListObjects": IntegerDatabaseField(name="ProfileEvents_S3ListObjects", nullable=False),- "S3HeadObject": IntegerDatabaseField(name="ProfileEvents_S3HeadObject", nullable=False),- "S3GetObjectAttributes": IntegerDatabaseField(name="ProfileEvents_S3GetObjectAttributes", nullable=False),- "S3GetObject": IntegerDatabaseField(name="ProfileEvents_S3GetObject", nullable=False),- "ReadBufferFromS3Bytes": IntegerDatabaseField(name="ProfileEvents_ReadBufferFromS3Bytes", nullable=False),+ "event_date": DateDatabaseField(+ name="event_date", nullable=False, description="Date partition the query was logged under."+ ),+ "event_time": DateTimeDatabaseField(+ name="event_time", nullable=False, description="When the query log entry was written."+ ),+ "query_id": StringDatabaseField(+ name="lc_client_query_id", nullable=False, description="Client-supplied query identifier."+ ),+ "endpoint": StringDatabaseField(+ name="lc_id", nullable=False, description="Identifier of the endpoint/insight that issued the query."+ ),+ "query": StringDatabaseField(name="lc_query__query", nullable=False, description="The executed SQL query text."),+ "query_start_time": DateTimeDatabaseField(+ name="query_start_time", nullable=False, description="When ClickHouse started executing the query."+ ),+ "query_duration_ms": IntegerDatabaseField(+ name="query_duration_ms", nullable=False, description="Total query execution time in milliseconds."+ ),+ "name": StringDatabaseField(+ name="lc_request_name", nullable=False, description="Human-readable name of the originating request."+ ),+ "created_by": IntegerDatabaseField(+ name="lc_user_id", nullable=False, description="ID of the PostHog user who triggered the query."+ ),+ "read_rows": IntegerDatabaseField(+ name="read_rows", nullable=False, description="Number of rows ClickHouse read while executing the query."+ ),+ "read_bytes": IntegerDatabaseField(+ name="read_bytes", nullable=False, description="Number of bytes ClickHouse read while executing the query."+ ),+ "result_rows": IntegerDatabaseField(+ name="result_rows", nullable=False, description="Number of rows returned to the client."+ ),+ "result_bytes": IntegerDatabaseField(+ name="result_bytes", nullable=False, description="Number of bytes returned to the client."+ ),+ "memory_usage": IntegerDatabaseField(+ name="memory_usage", nullable=False, description="Peak memory used by the query in bytes."+ ),+ "status": StringDatabaseField(+ name="type",+ nullable=False,+ description="Query outcome type, e.g. 'QueryFinish' or 'ExceptionWhileProcessing'.",+ ),+ "exception_code": IntegerDatabaseField(+ name="exception_code", nullable=False, description="ClickHouse exception code if the query failed, else 0."+ ),+ "exception_name": StringDatabaseField(+ name="exception_name", nullable=False, description="ClickHouse exception name if the query failed."+ ),+ "is_personal_api_key_request": BooleanDatabaseField(+ name="is_personal_api_key_request",+ nullable=False,+ description="True if the query was issued via a personal API key.",+ ),+ "api_key_label": StringDatabaseField(+ name="lc_api_key_label", nullable=False, description="Label of the API key used, if any."+ ),+ "api_key_mask": StringDatabaseField(+ name="lc_api_key_mask", nullable=False, description="Masked value of the API key used, if any."+ ),+ "cpu_microseconds": IntegerDatabaseField(+ name="ProfileEvents_OSCPUVirtualTimeMicroseconds",+ nullable=False,+ description="CPU time consumed by the query in microseconds.",+ ),+ "RealTimeMicroseconds": IntegerDatabaseField(+ name="ProfileEvents_RealTimeMicroseconds",+ nullable=False,+ description="Wall-clock time consumed by the query in microseconds.",+ ),+ "S3ListObjects": IntegerDatabaseField(+ name="ProfileEvents_S3ListObjects", nullable=False, description="Count of S3 ListObjects calls made."+ ),+ "S3HeadObject": IntegerDatabaseField(+ name="ProfileEvents_S3HeadObject", nullable=False, description="Count of S3 HeadObject calls made."+ ),+ "S3GetObjectAttributes": IntegerDatabaseField(+ name="ProfileEvents_S3GetObjectAttributes",+ nullable=False,+ description="Count of S3 GetObjectAttributes calls made.",+ ),+ "S3GetObject": IntegerDatabaseField(+ name="ProfileEvents_S3GetObject", nullable=False, description="Count of S3 GetObject calls made."+ ),+ "ReadBufferFromS3Bytes": IntegerDatabaseField(+ name="ProfileEvents_ReadBufferFromS3Bytes", nullable=False, description="Bytes read from S3 by the query."+ ),# "cost_usd": FloatDatabaseField(name="cost_usd", nullable=False),}class QueryLogArchiveTable(LazyTable):+ description: str = (+ "Archived ClickHouse query log for analyzing query performance and cost. One row per executed query, "+ "with friendly column aliases over the raw log; impersonated requests are excluded."+ )fields: dict[str, FieldOrTable] = QUERY_LOG_ARCHIVE_FIELDSdef to_printed_clickhouse(self, context) -> str:@@ -111,29 +177,55 @@ class QueryLogArchiveTable(LazyTable):class RawQueryLogArchiveTable(Table):+ description: str = (+ "Raw archived ClickHouse query log, exposing the underlying `lc_*` columns directly. "+ "Prefer the `query_log` table, which provides friendly aliases and filters out impersonated requests."+ )fields: dict[str, FieldOrTable] = {"event_date": DateDatabaseField(name="event_date", nullable=False),"event_time": DateTimeDatabaseField(name="event_time", nullable=False),"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "query_id": StringDatabaseField(name="query_id", nullable=False),- "lc_client_query_id": StringDatabaseField(name="lc_client_query_id", nullable=False),- "lc_id": StringDatabaseField(name="lc_id", nullable=False),- "lc_query__query": StringDatabaseField(name="lc_query__query", nullable=False),+ "query_id": StringDatabaseField(+ name="query_id", nullable=False, description="ClickHouse-assigned query identifier."+ ),+ "lc_client_query_id": StringDatabaseField(+ name="lc_client_query_id", nullable=False, description="Client-supplied query identifier."+ ),+ "lc_id": StringDatabaseField(+ name="lc_id", nullable=False, description="Identifier of the endpoint/insight that issued the query."+ ),+ "lc_query__query": StringDatabaseField(+ name="lc_query__query", nullable=False, description="The executed SQL query text."+ ),"query_start_time": DateTimeDatabaseField(name="query_start_time", nullable=False),"query_duration_ms": IntegerDatabaseField(name="query_duration_ms", nullable=False),"lc_name": StringDatabaseField(name="lc_name", nullable=False),"lc_request_name": StringDatabaseField(name="lc_request_name", nullable=False),- "lc_user_id": IntegerDatabaseField(name="lc_user_id", nullable=False),+ "lc_user_id": IntegerDatabaseField(+ name="lc_user_id", nullable=False, description="ID of the PostHog user who triggered the query."+ ),"read_rows": IntegerDatabaseField(name="read_rows", nullable=False),"read_bytes": IntegerDatabaseField(name="read_bytes", nullable=False),"result_rows": IntegerDatabaseField(name="result_rows", nullable=False),"result_bytes": IntegerDatabaseField(name="result_bytes", nullable=False),"memory_usage": IntegerDatabaseField(name="memory_usage", nullable=False),- "type": StringDatabaseField(name="type", nullable=False),+ "type": StringDatabaseField(+ name="type",+ nullable=False,+ description="Query outcome type, e.g. 'QueryFinish' or 'ExceptionWhileProcessing'.",+ ),"exception_code": IntegerDatabaseField(name="exception_code", nullable=False),"exception_name": StringDatabaseField(name="exception_name", nullable=False),- "lc_access_method": StringDatabaseField(name="lc_access_method", nullable=False),- "lc_is_impersonated": BooleanDatabaseField(name="lc_is_impersonated", nullable=False),+ "lc_access_method": StringDatabaseField(+ name="lc_access_method",+ nullable=False,+ description="How the query was authenticated, e.g. 'personal_api_key'.",+ ),+ "lc_is_impersonated": BooleanDatabaseField(+ name="lc_is_impersonated",+ nullable=False,+ description="True if the request was made via staff impersonation.",+ ),"lc_api_key_label": StringDatabaseField(name="lc_api_key_label", nullable=False),"lc_api_key_mask": StringDatabaseField(name="lc_api_key_mask", nullable=False),"lc_query__kind": StringDatabaseField(name="lc_query__kind", nullable=False),diff --git a/posthog/hogql/database/schema/session_replay_events.py b/posthog/hogql/database/schema/session_replay_events.pyindex d963373871ea..414adc8c8681 100644--- a/posthog/hogql/database/schema/session_replay_events.py+++ b/posthog/hogql/database/schema/session_replay_events.py@@ -191,31 +191,89 @@ def join_with_console_logs_log_entries_table(RAW_ONLY_FIELDS = ["min_first_timestamp", "max_last_timestamp"]SESSION_REPLAY_EVENTS_COMMON_FIELDS: dict[str, FieldOrTable] = {- "session_id": StringDatabaseField(name="session_id", nullable=False),+ "session_id": StringDatabaseField(+ name="session_id",+ nullable=False,+ description="Recording session identifier; matches `events.$session_id` and `sessions.session_id`.",+ ),"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "distinct_id": StringDatabaseField(name="distinct_id", nullable=False),- "min_first_timestamp": DateTimeDatabaseField(name="min_first_timestamp", nullable=False),- "max_last_timestamp": DateTimeDatabaseField(name="max_last_timestamp", nullable=False),- "first_url": DatabaseField(name="first_url", nullable=True),- "all_urls": DatabaseField(name="all_urls", nullable=True),- "click_count": IntegerDatabaseField(name="click_count", nullable=False),- "keypress_count": IntegerDatabaseField(name="keypress_count", nullable=False),- "mouse_activity_count": IntegerDatabaseField(name="mouse_activity_count", nullable=False),- "active_milliseconds": IntegerDatabaseField(name="active_milliseconds", nullable=False),- "console_log_count": IntegerDatabaseField(name="console_log_count", nullable=False),- "console_warn_count": IntegerDatabaseField(name="console_warn_count", nullable=False),- "console_error_count": IntegerDatabaseField(name="console_error_count", nullable=False),- "size": IntegerDatabaseField(name="size", nullable=False),- "event_count": IntegerDatabaseField(name="event_count", nullable=False),- "message_count": IntegerDatabaseField(name="message_count", nullable=False),- "snapshot_source": StringDatabaseField(name="snapshot_source", nullable=True),- "snapshot_library": StringDatabaseField(name="snapshot_library", nullable=True),- "retention_period_days": IntegerDatabaseField(name="retention_period_days", nullable=True),- "is_deleted": IntegerDatabaseField(name="is_deleted", nullable=False),- "ai_tags_fixed": DatabaseField(name="ai_tags_fixed", nullable=True),- "ai_tags_freeform": DatabaseField(name="ai_tags_freeform", nullable=True),- "ai_highlighted": IntegerDatabaseField(name="ai_highlighted", nullable=False),- "surfacing_score": DatabaseField(name="surfacing_score", nullable=True),+ "distinct_id": StringDatabaseField(+ name="distinct_id", nullable=False, description="Identifier of the user/device for the recording."+ ),+ "min_first_timestamp": DateTimeDatabaseField(+ name="min_first_timestamp",+ nullable=False,+ description="Earliest snapshot timestamp in this raw segment (in UTC); aggregated into `start_time`.",+ ),+ "max_last_timestamp": DateTimeDatabaseField(+ name="max_last_timestamp",+ nullable=False,+ description="Latest snapshot timestamp in this raw segment (in UTC); aggregated into `end_time`.",+ ),+ "first_url": DatabaseField(+ name="first_url", nullable=True, description="URL of the first page viewed in the session."+ ),+ "all_urls": DatabaseField(+ name="all_urls", nullable=True, description="Distinct set of URLs visited during the session."+ ),+ "click_count": IntegerDatabaseField(+ name="click_count", nullable=False, description="Total number of clicks in the session."+ ),+ "keypress_count": IntegerDatabaseField(+ name="keypress_count", nullable=False, description="Total number of keypresses in the session."+ ),+ "mouse_activity_count": IntegerDatabaseField(+ name="mouse_activity_count", nullable=False, description="Number of mouse activity events in the session."+ ),+ "active_milliseconds": IntegerDatabaseField(+ name="active_milliseconds",+ nullable=False,+ description="Time the user was actively interacting, in milliseconds (subset of total duration).",+ ),+ "console_log_count": IntegerDatabaseField(+ name="console_log_count", nullable=False, description="Number of console.log messages captured."+ ),+ "console_warn_count": IntegerDatabaseField(+ name="console_warn_count", nullable=False, description="Number of console.warn messages captured."+ ),+ "console_error_count": IntegerDatabaseField(+ name="console_error_count", nullable=False, description="Number of console.error messages captured."+ ),+ "size": IntegerDatabaseField(+ name="size", nullable=False, description="Size of the recording snapshot data in bytes."+ ),+ "event_count": IntegerDatabaseField(+ name="event_count", nullable=False, description="Number of rrweb snapshot events in the recording."+ ),+ "message_count": IntegerDatabaseField(+ name="message_count", nullable=False, description="Number of ingestion messages that made up this recording."+ ),+ "snapshot_source": StringDatabaseField(+ name="snapshot_source", nullable=True, description="Capture source of the recording, e.g. 'web' or 'mobile'."+ ),+ "snapshot_library": StringDatabaseField(+ name="snapshot_library", nullable=True, description="SDK/library that produced the recording snapshots."+ ),+ "retention_period_days": IntegerDatabaseField(+ name="retention_period_days", nullable=True, description="Number of days the recording is retained."+ ),+ "is_deleted": IntegerDatabaseField(+ name="is_deleted", nullable=False, description="Whether the recording has been deleted (1) or not (0)."+ ),+ "ai_tags_fixed": DatabaseField(+ name="ai_tags_fixed", nullable=True, description="AI-assigned tags from a fixed taxonomy."+ ),+ "ai_tags_freeform": DatabaseField(name="ai_tags_freeform", nullable=True, description="AI-assigned freeform tags."),+ "ai_highlighted": IntegerDatabaseField(+ name="ai_highlighted",+ nullable=False,+ description="Whether AI flagged this recording as noteworthy (1) or not (0).",+ ),+ "surfacing_score": DatabaseField(+ name="surfacing_score",+ nullable=True,+ description="AI-computed score ranking how worth surfacing the recording is.",+ ),"events": LazyJoin(from_field=["session_id"],join_table=EventsTable(),@@ -244,6 +302,10 @@ SESSION_REPLAY_EVENTS_COMMON_FIELDS: dict[str, FieldOrTable] = {class RawSessionReplayEventsTable(Table):+ description: str = (+ "Raw per-segment aggregate state for session recordings; multiple rows per session. "+ "Query the deduplicated `session_replay_events` table to get one aggregated row per session."+ )fields: dict[str, FieldOrTable] = {**SESSION_REPLAY_EVENTS_COMMON_FIELDS,"min_first_timestamp": DateTimeDatabaseField(name="min_first_timestamp", nullable=False),@@ -315,12 +377,24 @@ def select_from_session_replay_events_table(requested_fields: dict[str, list[strclass SessionReplayEventsTable(LazyTable):+ description: str = (+ "Aggregated metadata for session recordings (counts, URLs, console/activity stats); one row per session. "+ "Holds metadata only, not the recording snapshots. Join to events/persons via `session_id`/`distinct_id`."+ )fields: dict[str, FieldOrTable] = {**{k: v for k, v in SESSION_REPLAY_EVENTS_COMMON_FIELDS.items() if k not in RAW_ONLY_FIELDS},- "start_time": DateTimeDatabaseField(name="start_time", nullable=False),- "end_time": DateTimeDatabaseField(name="end_time", nullable=False),- "first_url": StringDatabaseField(name="first_url", nullable=True),- "is_deleted": IntegerDatabaseField(name="is_deleted", nullable=False),+ "start_time": DateTimeDatabaseField(+ name="start_time", nullable=False, description="Earliest snapshot timestamp across the session (in UTC)."+ ),+ "end_time": DateTimeDatabaseField(+ name="end_time", nullable=False, description="Latest snapshot timestamp across the session (in UTC)."+ ),+ "first_url": StringDatabaseField(+ name="first_url", nullable=True, description="URL of the first page viewed in the session."+ ),+ "is_deleted": IntegerDatabaseField(+ name="is_deleted", nullable=False, description="Whether the recording has been deleted (1) or not (0)."+ ),}def lazy_select(self, table_to_add: LazyTableToAdd, context, node):diff --git a/posthog/hogql/database/schema/session_replay_features.py b/posthog/hogql/database/schema/session_replay_features.pyindex 2d805393ab0a..29bdb333f2a7 100644--- a/posthog/hogql/database/schema/session_replay_features.py+++ b/posthog/hogql/database/schema/session_replay_features.py@@ -10,19 +10,37 @@ from posthog.hogql.database.models import (class SessionReplayFeaturesTable(Table):+ description: str = (+ "Per-session behavioural feature aggregates derived from recordings (mouse, scroll, click, network, "+ "and timing statistics) used for replay scoring and analysis. Join to recordings via `session_id`."+ )fields: dict[str, FieldOrTable] = {- "session_id": StringDatabaseField(name="session_id", nullable=False),+ "session_id": StringDatabaseField(+ name="session_id",+ nullable=False,+ description="Recording session identifier; matches `session_replay_events.session_id`.",+ ),"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "distinct_id": StringDatabaseField(name="distinct_id", nullable=False),- "min_first_timestamp": DateTimeDatabaseField(name="min_first_timestamp", nullable=False),- "max_last_timestamp": DateTimeDatabaseField(name="max_last_timestamp", nullable=False),- "event_count": IntegerDatabaseField(name="event_count", nullable=False),+ "distinct_id": StringDatabaseField(+ name="distinct_id", nullable=False, description="Identifier of the user/device for the session."+ ),+ "min_first_timestamp": DateTimeDatabaseField(+ name="min_first_timestamp", nullable=False, description="Earliest event timestamp in the session (in UTC)."+ ),+ "max_last_timestamp": DateTimeDatabaseField(+ name="max_last_timestamp", nullable=False, description="Latest event timestamp in the session (in UTC)."+ ),+ "event_count": IntegerDatabaseField(+ name="event_count", nullable=False, description="Number of snapshot events in the session."+ ),"mouse_position_count": IntegerDatabaseField(name="mouse_position_count", nullable=False),"mouse_sum_x": FloatDatabaseField(name="mouse_sum_x", nullable=False),"mouse_sum_x_squared": FloatDatabaseField(name="mouse_sum_x_squared", nullable=False),"mouse_sum_y": FloatDatabaseField(name="mouse_sum_y", nullable=False),"mouse_sum_y_squared": FloatDatabaseField(name="mouse_sum_y_squared", nullable=False),- "mouse_distance_traveled": FloatDatabaseField(name="mouse_distance_traveled", nullable=False),+ "mouse_distance_traveled": FloatDatabaseField(+ name="mouse_distance_traveled", nullable=False, description="Total cursor travel distance, in pixels."+ ),"mouse_direction_change_count": IntegerDatabaseField(name="mouse_direction_change_count", nullable=False),"mouse_velocity_sum": FloatDatabaseField(name="mouse_velocity_sum", nullable=False),"mouse_velocity_sum_of_squares": FloatDatabaseField(name="mouse_velocity_sum_of_squares", nullable=False),@@ -36,30 +54,62 @@ class SessionReplayFeaturesTable(Table):"mouse_activity_count": IntegerDatabaseField(name="mouse_activity_count", nullable=False),"rage_click_count": IntegerDatabaseField(name="rage_click_count", nullable=False),"dead_click_count": IntegerDatabaseField(name="dead_click_count", nullable=False),- "inter_action_gap_count": IntegerDatabaseField(name="inter_action_gap_count", nullable=False),- "inter_action_gap_sum_ms": FloatDatabaseField(name="inter_action_gap_sum_ms", nullable=False),+ "inter_action_gap_count": IntegerDatabaseField(+ name="inter_action_gap_count",+ nullable=False,+ description="Number of gaps measured between consecutive actions.",+ ),+ "inter_action_gap_sum_ms": FloatDatabaseField(+ name="inter_action_gap_sum_ms", nullable=False, description="Sum of gaps between actions, in milliseconds."+ ),"inter_action_gap_sum_of_squares_ms": FloatDatabaseField(- name="inter_action_gap_sum_of_squares_ms", nullable=False+ name="inter_action_gap_sum_of_squares_ms",+ nullable=False,+ description="Sum of squared inter-action gaps (ms²), for computing variance.",+ ),+ "max_idle_gap_ms": FloatDatabaseField(+ name="max_idle_gap_ms", nullable=False, description="Longest gap between actions, in milliseconds."),- "max_idle_gap_ms": FloatDatabaseField(name="max_idle_gap_ms", nullable=False),"quick_back_count": IntegerDatabaseField(name="quick_back_count", nullable=False),"page_visit_count": IntegerDatabaseField(name="page_visit_count", nullable=False),"console_error_count": IntegerDatabaseField(name="console_error_count", nullable=False),"console_error_after_click_count": IntegerDatabaseField(name="console_error_after_click_count", nullable=False),"network_request_count": IntegerDatabaseField(name="network_request_count", nullable=False),"network_failed_request_count": IntegerDatabaseField(name="network_failed_request_count", nullable=False),- "network_request_duration_sum": FloatDatabaseField(name="network_request_duration_sum", nullable=False),+ "network_request_duration_sum": FloatDatabaseField(+ name="network_request_duration_sum",+ nullable=False,+ description="Sum of network request durations, in milliseconds.",+ ),"network_request_duration_sum_of_squares": FloatDatabaseField(- name="network_request_duration_sum_of_squares", nullable=False+ name="network_request_duration_sum_of_squares",+ nullable=False,+ description="Sum of squared network request durations (ms²), for computing variance.",+ ),+ "network_request_duration_count": IntegerDatabaseField(+ name="network_request_duration_count",+ nullable=False,+ description="Number of network requests contributing to the duration aggregates.",+ ),+ "max_scroll_y": FloatDatabaseField(+ name="max_scroll_y", nullable=False, description="Furthest vertical scroll position reached, in pixels."),- "network_request_duration_count": IntegerDatabaseField(name="network_request_duration_count", nullable=False),- "max_scroll_y": FloatDatabaseField(name="max_scroll_y", nullable=False),"text_selection_count": IntegerDatabaseField(name="text_selection_count", nullable=False),- "is_deleted": IntegerDatabaseField(name="is_deleted", nullable=False),+ "is_deleted": IntegerDatabaseField(+ name="is_deleted", nullable=False, description="Whether the session has been deleted (1) or not (0)."+ ),# AggregateFunction(uniqExact, …) state. Exposed as plain DatabaseField so users must wrap with# uniqExactMerge to get a count. Anything stricter would prevent the merge call from typechecking.- "unique_url_count": DatabaseField(name="unique_url_count", nullable=True),- "unique_click_target_count": DatabaseField(name="unique_click_target_count", nullable=True),+ "unique_url_count": DatabaseField(+ name="unique_url_count",+ nullable=True,+ description="uniqExact aggregate state for distinct URLs; wrap with uniqExactMerge to get a count.",+ ),+ "unique_click_target_count": DatabaseField(+ name="unique_click_target_count",+ nullable=True,+ description="uniqExact aggregate state for distinct click targets; wrap with uniqExactMerge to get a count.",+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/sessions_v1.py b/posthog/hogql/database/schema/sessions_v1.pyindex aaf6597d4886..9266cabf1e50 100644--- a/posthog/hogql/database/schema/sessions_v1.py+++ b/posthog/hogql/database/schema/sessions_v1.py@@ -76,23 +76,49 @@ RAW_SESSIONS_FIELDS: dict[str, FieldOrTable] = {}LAZY_SESSIONS_FIELDS: dict[str, FieldOrTable] = {- "id": StringDatabaseField(name="session_id", nullable=False),+ "id": StringDatabaseField(+ name="session_id", nullable=False, description="Session identifier; matches `events.$session_id`."+ ),# TODO remove this, it's a duplicate of the correct session_id field below to get some trends working on a deadline- "session_id": StringDatabaseField(name="session_id", nullable=False),+ "session_id": StringDatabaseField(+ name="session_id", nullable=False, description="Session identifier; matches `events.$session_id`."+ ),"team_id": IntegerDatabaseField(name="team_id", nullable=False),"distinct_id": StringDatabaseField(name="distinct_id", nullable=False),- "$start_timestamp": DateTimeDatabaseField(name="$start_timestamp", nullable=False),- "$end_timestamp": DateTimeDatabaseField(name="$end_timestamp", nullable=False),+ "$start_timestamp": DateTimeDatabaseField(+ name="$start_timestamp", nullable=False, description="Timestamp of the first event in the session."+ ),+ "$end_timestamp": DateTimeDatabaseField(+ name="$end_timestamp", nullable=False, description="Timestamp of the last event in the session."+ ),# URLs / paths- "$urls": StringArrayDatabaseField(name="$urls", nullable=False),- "$num_uniq_urls": IntegerDatabaseField(name="$num_uniq_urls", nullable=False),- "$entry_current_url": StringDatabaseField(name="$entry_current_url"),- "$entry_pathname": StringDatabaseField(name="$entry_pathname"),- "$entry_hostname": StringDatabaseField(name="$entry_host"),- "$exit_current_url": StringDatabaseField(name="$exit_current_url"),- "$exit_pathname": StringDatabaseField(name="$exit_pathname"),- "$exit_hostname": StringDatabaseField(name="$exit_host"),- "$entry_referring_domain": StringDatabaseField(name="$entry_referring_domain"),+ "$urls": StringArrayDatabaseField(+ name="$urls", nullable=False, description="Distinct URLs visited during the session."+ ),+ "$num_uniq_urls": IntegerDatabaseField(+ name="$num_uniq_urls", nullable=False, description="Number of distinct URLs visited during the session."+ ),+ "$entry_current_url": StringDatabaseField(+ name="$entry_current_url", description="Full URL of the first page viewed in the session."+ ),+ "$entry_pathname": StringDatabaseField(+ name="$entry_pathname", description="Path of the first page viewed in the session (URL without host or query)."+ ),+ "$entry_hostname": StringDatabaseField(+ name="$entry_host", description="Host of the first page viewed in the session."+ ),+ "$exit_current_url": StringDatabaseField(+ name="$exit_current_url", description="Full URL of the last page viewed in the session."+ ),+ "$exit_pathname": StringDatabaseField(+ name="$exit_pathname", description="Path of the last page viewed in the session (URL without host or query)."+ ),+ "$exit_hostname": StringDatabaseField(+ name="$exit_host", description="Host of the last page viewed in the session."+ ),+ "$entry_referring_domain": StringDatabaseField(+ name="$entry_referring_domain", description="Referring domain that brought the user into the session."+ ),# UTM parameters"$entry_utm_source": StringDatabaseField(name="$entry_utm_source"),"$entry_utm_campaign": StringDatabaseField(name="$entry_utm_campaign"),@@ -118,12 +144,20 @@ LAZY_SESSIONS_FIELDS: dict[str, FieldOrTable] = {"$pageview_count": IntegerDatabaseField(name="$pageview_count"),"$autocapture_count": IntegerDatabaseField(name="$autocapture_count"),# Derived- "$channel_type": StringDatabaseField(name="$channel_type"),- "$session_duration": IntegerDatabaseField(name="$session_duration"),+ "$channel_type": StringDatabaseField(+ name="$channel_type",+ description="Derived acquisition channel (e.g. Organic Search, Paid Social) for the session.",+ ),+ "$session_duration": IntegerDatabaseField(+ name="$session_duration", description="Session duration in seconds ($end_timestamp - $start_timestamp)."+ ),"duration": IntegerDatabaseField(name="duration"), # alias of $session_duration, deprecated but included for backwards compatibility- "$is_bounce": BooleanDatabaseField(name="$is_bounce"),+ "$is_bounce": BooleanDatabaseField(+ name="$is_bounce",+ description="True if the session was a bounce (single page view, short duration, no interaction).",+ ),# some aliases for people reverting from v2 to v1"$end_current_url": StringDatabaseField(name="$end_current_url"),"$end_pathname": StringDatabaseField(name="$end_pathname"),@@ -131,6 +165,10 @@ LAZY_SESSIONS_FIELDS: dict[str, FieldOrTable] = {class RawSessionsTableV1(Table):+ description: str = (+ "Raw sessions aggregate-state table backing `sessions`. Columns hold AggregateFunction states that "+ "must be merged; query `sessions` instead unless you specifically need the raw states."+ )fields: dict[str, FieldOrTable] = RAW_SESSIONS_FIELDSdef to_printed_clickhouse(self, context):@@ -359,6 +397,10 @@ def select_from_sessions_table_v1(class SessionsTableV1(LazyTable):+ description: str = (+ "Aggregated user sessions (one row per session), with entry/exit URLs, attribution, and duration. "+ "Join from events via `events.$session_id = sessions.session_id`."+ )fields: dict[str, FieldOrTable] = LAZY_SESSIONS_FIELDSdef lazy_select(diff --git a/posthog/hogql/database/schema/sessions_v3.py b/posthog/hogql/database/schema/sessions_v3.pyindex bd8ff231b123..602dd91fa5c8 100644--- a/posthog/hogql/database/schema/sessions_v3.py+++ b/posthog/hogql/database/schema/sessions_v3.py@@ -92,27 +92,57 @@ RAW_SESSIONS_FIELDS: dict[str, FieldOrTable] = {LAZY_SESSIONS_FIELDS: dict[str, FieldOrTable] = {# IDs"team_id": IntegerDatabaseField(name="team_id"),- "session_id_v7": StringDatabaseField(name="session_id_v7"),- "id": StringDatabaseField(name="id"),+ "session_id_v7": StringDatabaseField(+ name="session_id_v7", description="Preferred session identifier (UUIDv7); join target for `events.$session_id`."+ ),+ "id": StringDatabaseField(name="id", description="Session identifier; matches `events.$session_id`."),# TODO remove this, it's a duplicate of the correct session_id field below to get some trends working on a deadline- "session_id": StringDatabaseField(name="session_id"),- "session_timestamp": DateTimeDatabaseField(name="session_timestamp", nullable=False),+ "session_id": StringDatabaseField(+ name="session_id", description="Session identifier; matches `events.$session_id`."+ ),+ "session_timestamp": DateTimeDatabaseField(+ name="session_timestamp",+ nullable=False,+ description="Timestamp embedded in the session id; prefer `$start_timestamp` for most queries.",+ ),"distinct_id": StringDatabaseField(name="distinct_id"),# timestamp- "$start_timestamp": DateTimeDatabaseField(name="$start_timestamp"),- "$end_timestamp": DateTimeDatabaseField(name="$end_timestamp"),+ "$start_timestamp": DateTimeDatabaseField(+ name="$start_timestamp", description="Timestamp of the first event in the session."+ ),+ "$end_timestamp": DateTimeDatabaseField(+ name="$end_timestamp", description="Timestamp of the last event in the session."+ ),"max_inserted_at": DateTimeDatabaseField(name="max_inserted_at"),# URLs- "$urls": StringArrayDatabaseField(name="$urls"),- "$num_uniq_urls": IntegerDatabaseField(name="$num_uniq_urls"),- "$entry_current_url": StringDatabaseField(name="$entry_current_url"),- "$entry_pathname": StringDatabaseField(name="$entry_pathname"),- "$entry_hostname": StringDatabaseField(name="$entry_host"),- "$end_current_url": StringDatabaseField(name="$end_current_url"),- "$end_pathname": StringDatabaseField(name="$end_pathname"),- "$end_hostname": StringDatabaseField(name="$end_hostname"),- "$entry_referring_domain": StringDatabaseField(name="$entry_referring_domain"),- "$last_external_click_url": StringDatabaseField(name="$last_external_click_url"),+ "$urls": StringArrayDatabaseField(name="$urls", description="Distinct URLs visited during the session."),+ "$num_uniq_urls": IntegerDatabaseField(+ name="$num_uniq_urls", description="Number of distinct URLs visited during the session."+ ),+ "$entry_current_url": StringDatabaseField(+ name="$entry_current_url", description="Full URL of the first page viewed in the session."+ ),+ "$entry_pathname": StringDatabaseField(+ name="$entry_pathname", description="Path of the first page viewed in the session (URL without host or query)."+ ),+ "$entry_hostname": StringDatabaseField(+ name="$entry_host", description="Host of the first page viewed in the session."+ ),+ "$end_current_url": StringDatabaseField(+ name="$end_current_url", description="Full URL of the last page viewed in the session."+ ),+ "$end_pathname": StringDatabaseField(+ name="$end_pathname", description="Path of the last page viewed in the session (URL without host or query)."+ ),+ "$end_hostname": StringDatabaseField(+ name="$end_hostname", description="Host of the last page viewed in the session."+ ),+ "$entry_referring_domain": StringDatabaseField(+ name="$entry_referring_domain", description="Referring domain that brought the user into the session."+ ),+ "$last_external_click_url": StringDatabaseField(+ name="$last_external_click_url", description="URL of the last outbound (external) link clicked in the session."+ ),# some aliases for people upgrading from v1 to v2/v3"$exit_current_url": StringDatabaseField(name="$exit_current_url"),"$exit_pathname": StringDatabaseField(name="$exit_pathname"),@@ -136,15 +166,27 @@ LAZY_SESSIONS_FIELDS: dict[str, FieldOrTable] = {"$has_autocapture": BooleanDatabaseField(name="$has_autocapture"),"$entry_channel_type_properties": DatabaseField(name="$entry_channel_type_properties"),# computed fields- "$channel_type": StringDatabaseField(name="$channel_type"),- "$session_duration": IntegerDatabaseField(name="$session_duration"),+ "$channel_type": StringDatabaseField(+ name="$channel_type",+ description="Derived acquisition channel (e.g. Organic Search, Paid Social) for the session.",+ ),+ "$session_duration": IntegerDatabaseField(+ name="$session_duration", description="Session duration in seconds ($end_timestamp - $start_timestamp)."+ ),"duration": IntegerDatabaseField(name="duration"), # alias of $session_duration, deprecated but included for backwards compatibility- "$is_bounce": BooleanDatabaseField(name="$is_bounce"),- "$hosts": StringArrayDatabaseField(name="$hosts"),- "$emails": StringArrayDatabaseField(name="$emails"),- "$has_replay_events": BooleanDatabaseField(name="$has_replay_events", nullable=False),+ "$is_bounce": BooleanDatabaseField(+ name="$is_bounce",+ description="True if the session was a bounce (single page view, short duration, no interaction).",+ ),+ "$hosts": StringArrayDatabaseField(name="$hosts", description="Distinct hosts visited during the session."),+ "$emails": StringArrayDatabaseField(name="$emails", description="Distinct emails associated with the session."),+ "$has_replay_events": BooleanDatabaseField(+ name="$has_replay_events",+ nullable=False,+ description="True if the session has session replay recording events.",+ ),}@@ -158,6 +200,10 @@ def get_binary_fields(table: Table) -> set[str]:class RawSessionsTableV3(Table):+ description: str = (+ "Raw v3 sessions aggregate-state table backing `sessions` (v3). Columns hold AggregateFunction states "+ "that must be merged; query the streamlined sessions table instead unless you need the raw states."+ )fields: dict[str, FieldOrTable] = RAW_SESSIONS_FIELDSdef to_printed_clickhouse(self, context):@@ -401,6 +447,10 @@ def select_from_sessions_table_v3(class SessionsTableV3(LazyTable):+ description: str = (+ "Aggregated user sessions (one row per session), with entry/exit URLs, attribution, device/geo info, "+ "and duration. Join from events via `events.$session_id = sessions.session_id`."+ )fields: dict[str, FieldOrTable] = LAZY_SESSIONS_FIELDSdef lazy_select(diff --git a/posthog/hogql/database/schema/spans.py b/posthog/hogql/database/schema/spans.pyindex b5c86280617c..a9940575eec2 100644--- a/posthog/hogql/database/schema/spans.py+++ b/posthog/hogql/database/schema/spans.py@@ -12,28 +12,63 @@ from posthog.clickhouse.workload import Workloadclass TraceSpansTable(Table):+ description: str = "OpenTelemetry trace spans, one row per span; join to `logs` on `trace_id`/`span_id`."workload: Workload | None = Workload.LOGSfields: dict[str, FieldOrTable] = {- "uuid": StringDatabaseField(name="uuid", nullable=False),+ "uuid": StringDatabaseField(name="uuid", nullable=False, description="Unique identifier of this span row."),"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "trace_id": StringDatabaseField(name="trace_id", nullable=False),- "span_id": StringDatabaseField(name="span_id", nullable=False),- "parent_span_id": StringDatabaseField(name="parent_span_id", nullable=False),- "is_root_span": BooleanDatabaseField(name="is_root_span", nullable=False),- "name": StringDatabaseField(name="name", nullable=False),- "kind": IntegerDatabaseField(name="kind", nullable=False),- "timestamp": DateTimeDatabaseField(name="timestamp", nullable=False),- "end_time": DateTimeDatabaseField(name="end_time", nullable=False),- "observed_timestamp": DateTimeDatabaseField(name="observed_timestamp", nullable=False),- "duration_nano": IntegerDatabaseField(name="duration_nano", nullable=False),- "status_code": IntegerDatabaseField(name="status_code", nullable=False),- "service_name": StringDatabaseField(name="service_name", nullable=False),- "resource_attributes": MapStringDatabaseField(name="resource_attributes", nullable=False),- "resource_fingerprint": IntegerDatabaseField(name="resource_fingerprint", nullable=False),- "attributes": MapStringDatabaseField(name="attributes", nullable=False),- "instrumentation_scope": StringDatabaseField(name="instrumentation_scope", nullable=False),- "time_bucket": DateTimeDatabaseField(name="time_bucket", nullable=False),+ "trace_id": StringDatabaseField(+ name="trace_id", nullable=False, description="Identifier of the trace this span belongs to."+ ),+ "span_id": StringDatabaseField(name="span_id", nullable=False, description="Unique identifier of this span."),+ "parent_span_id": StringDatabaseField(+ name="parent_span_id", nullable=False, description="Identifier of the parent span; empty for root spans."+ ),+ "is_root_span": BooleanDatabaseField(+ name="is_root_span", nullable=False, description="True if this span has no parent (the trace root)."+ ),+ "name": StringDatabaseField(+ name="name", nullable=False, description="Name of the operation the span represents."+ ),+ "kind": IntegerDatabaseField(+ name="kind",+ nullable=False,+ description="OpenTelemetry span kind (0=unspecified, 1=internal, 2=server, 3=client, 4=producer, 5=consumer).",+ ),+ "timestamp": DateTimeDatabaseField(name="timestamp", nullable=False, description="When the span started."),+ "end_time": DateTimeDatabaseField(name="end_time", nullable=False, description="When the span ended."),+ "observed_timestamp": DateTimeDatabaseField(+ name="observed_timestamp", nullable=False, description="When the collector observed/ingested the span."+ ),+ "duration_nano": IntegerDatabaseField(+ name="duration_nano", nullable=False, description="Span duration in nanoseconds."+ ),+ "status_code": IntegerDatabaseField(+ name="status_code", nullable=False, description="OpenTelemetry status code (0=unset, 1=ok, 2=error)."+ ),+ "service_name": StringDatabaseField(+ name="service_name", nullable=False, description="Name of the service that emitted the span."+ ),+ "resource_attributes": MapStringDatabaseField(+ name="resource_attributes", nullable=False, description="OpenTelemetry resource attributes as a string map."+ ),+ "resource_fingerprint": IntegerDatabaseField(+ name="resource_fingerprint",+ nullable=False,+ description="Hash of the resource attributes, used to group resources.",+ ),+ "attributes": MapStringDatabaseField(+ name="attributes", nullable=False, description="Per-span OpenTelemetry attributes as a string map."+ ),+ "instrumentation_scope": StringDatabaseField(+ name="instrumentation_scope",+ nullable=False,+ description="Instrumentation scope (library/module) that emitted the span.",+ ),+ "time_bucket": DateTimeDatabaseField(+ name="time_bucket", nullable=False, description="Coarse time bucket used for partitioning and filtering."+ ),}def to_printed_clickhouse(self, context):@@ -44,17 +79,38 @@ class TraceSpansTable(Table):class TraceAttributesTable(Table):+ description: str = "Distinct trace span attribute key/value pairs with occurrence counts, used to power span attribute autocomplete and faceting."workload: Workload | None = Workload.LOGSfields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id", nullable=False),- "time_bucket": DateTimeDatabaseField(name="time_bucket", nullable=False),- "attribute_key": StringDatabaseField(name="attribute_key", nullable=False),- "attribute_value": StringDatabaseField(name="attribute_value", nullable=False),- "attribute_type": StringDatabaseField(name="attribute_type", nullable=False),- "attribute_count": IntegerDatabaseField(name="attribute_count", nullable=False),- "resource_fingerprint": IntegerDatabaseField(name="resource_fingerprint", nullable=False),- "service_name": StringDatabaseField(name="service_name", nullable=False),+ "time_bucket": DateTimeDatabaseField(+ name="time_bucket",+ nullable=False,+ description="Coarse time bucket the attribute counts are aggregated over.",+ ),+ "attribute_key": StringDatabaseField(name="attribute_key", nullable=False, description="Span attribute name."),+ "attribute_value": StringDatabaseField(+ name="attribute_value", nullable=False, description="Observed value for the attribute key."+ ),+ "attribute_type": StringDatabaseField(+ name="attribute_type",+ nullable=False,+ description="Where the attribute came from (e.g. resource vs span attribute).",+ ),+ "attribute_count": IntegerDatabaseField(+ name="attribute_count",+ nullable=False,+ description="Number of spans with this key/value in the time bucket.",+ ),+ "resource_fingerprint": IntegerDatabaseField(+ name="resource_fingerprint",+ nullable=False,+ description="Hash of the resource attributes the count is scoped to.",+ ),+ "service_name": StringDatabaseField(+ name="service_name", nullable=False, description="Service the attribute counts are scoped to."+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/static_cohort_people.py b/posthog/hogql/database/schema/static_cohort_people.pyindex b9a3173e9611..4537e66664f3 100644--- a/posthog/hogql/database/schema/static_cohort_people.py+++ b/posthog/hogql/database/schema/static_cohort_people.py@@ -3,9 +3,17 @@ from posthog.hogql.database.models import FieldOrTable, IntegerDatabaseField, Laclass StaticCohortPeople(Table):+ description: str = (+ "Membership of static cohorts — fixed lists of people (e.g. CSV-imported) that are not recalculated. "+ "One row per person per cohort. Dynamic (calculated) cohorts live in `cohort_people`."+ )fields: dict[str, FieldOrTable] = {- "person_id": StringDatabaseField(name="person_id", nullable=False),- "cohort_id": IntegerDatabaseField(name="cohort_id", nullable=False),+ "person_id": StringDatabaseField(+ name="person_id", nullable=False, description="Person who is a member of the cohort; join to `persons.id`."+ ),+ "cohort_id": IntegerDatabaseField(+ name="cohort_id", nullable=False, description="Identifier of the static cohort this person belongs to."+ ),"team_id": IntegerDatabaseField(name="team_id", nullable=False),"person": LazyJoin(from_field=["person_id"],diff --git a/posthog/hogql/database/schema/system.py b/posthog/hogql/database/schema/system.pyindex 5648097c20cf..22d66cd3a931 100644--- a/posthog/hogql/database/schema/system.py+++ b/posthog/hogql/database/schema/system.py@@ -30,12 +30,24 @@ from posthog.scopes import APIScopeObjectclass IngestionWarningsTable(Table):+ description: str = (+ "Warnings raised while ingesting events (e.g. malformed payloads, dropped properties); "+ "one row per warning. Backed by ClickHouse, not Postgres."+ )fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id", nullable=False, hidden=True),- "source": StringDatabaseField(name="source", nullable=False),- "type": StringDatabaseField(name="type", nullable=False),- "details": StringDatabaseField(name="details", nullable=False),- "timestamp": DateTimeDatabaseField(name="timestamp", nullable=False),+ "source": StringDatabaseField(+ name="source", nullable=False, description="Pipeline component that raised the warning."+ ),+ "type": StringDatabaseField(+ name="type", nullable=False, description="Warning category, e.g. the rule that fired."+ ),+ "details": StringDatabaseField(+ name="details", nullable=False, description="JSON-encoded context about the specific occurrence."+ ),+ "timestamp": DateTimeDatabaseField(+ name="timestamp", nullable=False, description="When the warning was raised."+ ),}def to_printed_clickhouse(self, context):@@ -49,17 +61,34 @@ batch_export_backfills: PostgresTable = PostgresTable(name="batch_export_backfills",postgres_table_name="posthog_batchexportbackfill",access_scope="batch_export",+ description="Batch export backfill history; one row per backfill that re-exports a historical time range for a batch export.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Backfill UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "batch_export_id": StringDatabaseField(name="batch_export_id"),- "start_at": DateTimeDatabaseField(name="start_at", nullable=True),- "end_at": DateTimeDatabaseField(name="end_at", nullable=True),- "status": StringDatabaseField(name="status"),- "created_at": DateTimeDatabaseField(name="created_at"),- "finished_at": DateTimeDatabaseField(name="finished_at", nullable=True),- "last_updated_at": DateTimeDatabaseField(name="last_updated_at"),- "total_records_count": IntegerDatabaseField(name="total_records_count", nullable=True),+ "batch_export_id": StringDatabaseField(+ name="batch_export_id", description="Batch export this backfill belongs to; joins to batch_exports.id."+ ),+ "start_at": DateTimeDatabaseField(+ name="start_at",+ nullable=True,+ description="Start of the time range being backfilled (NULL means unbounded).",+ ),+ "end_at": DateTimeDatabaseField(+ name="end_at", nullable=True, description="End of the time range being backfilled (NULL means unbounded)."+ ),+ "status": StringDatabaseField(name="status", description="Backfill status, e.g. Running, Completed, Failed."),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the backfill was created."),+ "finished_at": DateTimeDatabaseField(+ name="finished_at", nullable=True, description="When the backfill finished; NULL while still running."+ ),+ "last_updated_at": DateTimeDatabaseField(+ name="last_updated_at", description="When the backfill row was last updated."+ ),+ "total_records_count": IntegerDatabaseField(+ name="total_records_count",+ nullable=True,+ description="Total number of records the backfill is expected to export.",+ ),},)@@ -67,24 +96,47 @@ batch_exports: PostgresTable = PostgresTable(name="batch_exports",postgres_table_name="posthog_batchexport",access_scope="batch_export",+ description="Configured batch exports that periodically ship event/person data to external destinations; one row per batch export.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Batch export UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),- "model": StringDatabaseField(name="model", nullable=True),- "interval": StringDatabaseField(name="interval"),+ "name": StringDatabaseField(name="name", description="User-given name of the batch export."),+ "model": StringDatabaseField(+ name="model", nullable=True, description="Data model exported, e.g. 'events' or 'persons'."+ ),+ "interval": StringDatabaseField(+ name="interval", description="Export cadence, e.g. 'hour', 'day', 'every 5 minutes'."+ ),"_paused": BooleanDatabaseField(name="paused", hidden=True),- "paused": ExpressionField(name="paused", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_paused"])])),+ "paused": ExpressionField(+ name="paused",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_paused"])]),+ description="1 if the export is paused, 0 if active.",+ ),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),"deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),- "destination_id": StringDatabaseField(name="destination_id"),- "timezone": StringDatabaseField(name="timezone"),- "interval_offset": IntegerDatabaseField(name="interval_offset", nullable=True),- "created_at": DateTimeDatabaseField(name="created_at"),- "last_updated_at": DateTimeDatabaseField(name="last_updated_at"),- "last_paused_at": DateTimeDatabaseField(name="last_paused_at", nullable=True),- "start_at": DateTimeDatabaseField(name="start_at", nullable=True),- "end_at": DateTimeDatabaseField(name="end_at", nullable=True),+ "destination_id": StringDatabaseField(+ name="destination_id", description="Identifier of the destination config the export writes to."+ ),+ "timezone": StringDatabaseField(+ name="timezone", description="Timezone used when computing export interval windows."+ ),+ "interval_offset": IntegerDatabaseField(+ name="interval_offset", nullable=True, description="Offset applied to interval windows, in seconds."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the batch export was created."),+ "last_updated_at": DateTimeDatabaseField(+ name="last_updated_at", description="When the config was last updated."+ ),+ "last_paused_at": DateTimeDatabaseField(+ name="last_paused_at", nullable=True, description="When the export was last paused."+ ),+ "start_at": DateTimeDatabaseField(+ name="start_at", nullable=True, description="Earliest data the export covers; NULL means unbounded."+ ),+ "end_at": DateTimeDatabaseField(+ name="end_at", nullable=True, description="Latest data the export covers; NULL means runs indefinitely."+ ),},)@@ -92,37 +144,65 @@ alerts: PostgresTable = PostgresTable(name="alerts",postgres_table_name="posthog_alertconfiguration",access_scope="alert",+ description="Insight alert configurations that notify users when an insight's value crosses a threshold; one row per alert.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Alert UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),- "insight_id": IntegerDatabaseField(name="insight_id"),- "enabled": BooleanDatabaseField(name="enabled"),- "state": StringDatabaseField(name="state"),- "calculation_interval": StringDatabaseField(name="calculation_interval"),- "condition": StringJSONDatabaseField(name="condition"),- "config": StringJSONDatabaseField(name="config"),- "created_at": DateTimeDatabaseField(name="created_at"),- "last_notified_at": DateTimeDatabaseField(name="last_notified_at"),- "last_checked_at": DateTimeDatabaseField(name="last_checked_at"),- "next_check_at": DateTimeDatabaseField(name="next_check_at"),- "snoozed_until": DateTimeDatabaseField(name="snoozed_until"),- "skip_weekend": BooleanDatabaseField(name="skip_weekend"),- "schedule_restriction": StringJSONDatabaseField(name="schedule_restriction"),+ "name": StringDatabaseField(name="name", description="User-given name of the alert."),+ "insight_id": IntegerDatabaseField(+ name="insight_id", description="Insight the alert watches; joins to insights.id."+ ),+ "enabled": BooleanDatabaseField(name="enabled", description="Whether the alert is active."),+ "state": StringDatabaseField(name="state", description="Current alert state, e.g. 'firing' or 'not_firing'."),+ "calculation_interval": StringDatabaseField(+ name="calculation_interval", description="How often the alert is evaluated, e.g. 'daily'."+ ),+ "condition": StringJSONDatabaseField(+ name="condition", description="JSON definition of the threshold/condition to check."+ ),+ "config": StringJSONDatabaseField(+ name="config", description="JSON alert configuration (series, comparison settings, etc.)."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the alert was created."),+ "last_notified_at": DateTimeDatabaseField(+ name="last_notified_at", description="When a notification was last sent."+ ),+ "last_checked_at": DateTimeDatabaseField(+ name="last_checked_at", description="When the alert was last evaluated."+ ),+ "next_check_at": DateTimeDatabaseField(+ name="next_check_at", description="When the alert is next scheduled to be evaluated."+ ),+ "snoozed_until": DateTimeDatabaseField(+ name="snoozed_until", description="Alert is snoozed (no notifications) until this time."+ ),+ "skip_weekend": BooleanDatabaseField(+ name="skip_weekend", description="Whether evaluation is skipped on weekends."+ ),+ "schedule_restriction": StringJSONDatabaseField(+ name="schedule_restriction", description="JSON restricting which days/hours the alert may fire."+ ),},)cohort_calculation_history: PostgresTable = PostgresTable(name="cohort_calculation_history",postgres_table_name="posthog_cohortcalculationhistory",+ description="History of cohort membership recalculations; one row per calculation run for a cohort.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Calculation run UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "cohort_id": IntegerDatabaseField(name="cohort_id"),- "count": IntegerDatabaseField(name="count"),- "started_at": DateTimeDatabaseField(name="started_at"),- "finished_at": DateTimeDatabaseField(name="finished_at"),- "error_code": StringDatabaseField(name="error_code"),+ "cohort_id": IntegerDatabaseField(+ name="cohort_id", description="Cohort that was recalculated; joins to cohorts.id."+ ),+ "count": IntegerDatabaseField(+ name="count", description="Number of people in the cohort after this calculation."+ ),+ "started_at": DateTimeDatabaseField(name="started_at", description="When the calculation started."),+ "finished_at": DateTimeDatabaseField(name="finished_at", description="When the calculation finished."),+ "error_code": StringDatabaseField(+ name="error_code", description="Error code if the calculation failed; empty on success."+ ),},)@@ -133,12 +213,18 @@ accounts: PostgresTable = PostgresTable(# `account` here (where the per-object grants are stored) instead of the# `customer_analytics` umbrella. Resource-level gating still works via RESOURCE_INHERITANCE_MAP.access_scope="account",+ description="Customer analytics accounts (companies/organizations being tracked); one row per account, with CRM identifiers extracted from properties.",fields={- "id": UUIDDatabaseField(name="id"),+ "id": UUIDDatabaseField(name="id", description="Account UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "external_id": StringDatabaseField(name="external_id", nullable=True),- "name": StringDatabaseField(name="name"),- "properties": StringJSONDatabaseField(name="properties"),+ "external_id": StringDatabaseField(+ name="external_id", nullable=True, description="Identifier of the account in the source system."+ ),+ "name": StringDatabaseField(name="name", description="Display name of the account."),+ "properties": StringJSONDatabaseField(+ name="properties",+ description="JSON map of account properties; the CRM id columns below are extracted from this.",+ ),"stripe_customer_id": ExpressionField(name="stripe_customer_id",expr=parse_expr("JSONExtractString(properties, 'stripe_customer_id')"),@@ -175,9 +261,13 @@ accounts: PostgresTable = PostgresTable("JSONExtract(properties, 'account_owner', 'Tuple(id Nullable(Int64), email Nullable(String))')"),),- "created_by_id": IntegerDatabaseField(name="created_by_id", nullable=True),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at", nullable=True),+ "created_by_id": IntegerDatabaseField(+ name="created_by_id", nullable=True, description="User who created the account record."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the account record was created."),+ "updated_at": DateTimeDatabaseField(+ name="updated_at", nullable=True, description="When the account record was last updated."+ ),"tags": account_tags_lazy_join,"notebooks": account_notebooks_lazy_join,},@@ -186,23 +276,38 @@ accounts: PostgresTable = PostgresTable(cohorts: PostgresTable = PostgresTable(name="cohorts",postgres_table_name="posthog_cohort",+ description="Cohorts: named groups of people defined by filters or as a static list; one row per cohort.",fields={- "id": IntegerDatabaseField(name="id"),+ "id": IntegerDatabaseField(name="id", description="Cohort id."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),- "description": StringDatabaseField(name="description"),+ "name": StringDatabaseField(name="name", description="Cohort name."),+ "description": StringDatabaseField(name="description", description="Cohort description."),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),- "filters": StringJSONDatabaseField(name="filters"),- "groups": StringJSONDatabaseField(name="groups"),- "query": StringJSONDatabaseField(name="query"),- "created_at": DateTimeDatabaseField(name="created_at"),- "last_calculation": DateTimeDatabaseField(name="last_calculation"),- "version": IntegerDatabaseField(name="version"),- "count": IntegerDatabaseField(name="count"),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the cohort has been deleted, 0 otherwise.",+ ),+ "filters": StringJSONDatabaseField(+ name="filters", description="JSON definition of the cohort's membership filters."+ ),+ "groups": StringJSONDatabaseField(+ name="groups", description="Legacy JSON cohort group definitions (superseded by filters)."+ ),+ "query": StringJSONDatabaseField(+ name="query", description="JSON HogQL query backing the cohort, if defined as a query."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the cohort was created."),+ "last_calculation": DateTimeDatabaseField(+ name="last_calculation", description="When cohort membership was last recalculated."+ ),+ "version": IntegerDatabaseField(name="version", description="Monotonic version bumped on each recalculation."),+ "count": IntegerDatabaseField(name="count", description="Number of people currently in the cohort."),"_is_static": BooleanDatabaseField(name="is_static", hidden=True),"is_static": ExpressionField(- name="is_static", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_is_static"])])+ name="is_static",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_is_static"])]),+ description="1 if the cohort is a fixed static list, 0 if dynamically calculated from filters.",),},)@@ -211,16 +316,23 @@ dashboards: PostgresTable = PostgresTable(name="dashboards",postgres_table_name="posthog_dashboard",access_scope="dashboard",+ description="Dashboards: collections of insight tiles; one row per dashboard.",fields={- "id": IntegerDatabaseField(name="id"),+ "id": IntegerDatabaseField(name="id", description="Dashboard id."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),- "description": StringDatabaseField(name="description"),- "created_at": DateTimeDatabaseField(name="created_at"),+ "name": StringDatabaseField(name="name", description="Dashboard name."),+ "description": StringDatabaseField(name="description", description="Dashboard description."),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the dashboard was created."),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),- "filters": StringJSONDatabaseField(name="filters"),- "variables": StringJSONDatabaseField(name="variables"),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the dashboard has been deleted, 0 otherwise.",+ ),+ "filters": StringJSONDatabaseField(+ name="filters", description="JSON dashboard-level filters applied to all tiles."+ ),+ "variables": StringJSONDatabaseField(name="variables", description="JSON dashboard-level template variables."),},)@@ -230,18 +342,39 @@ dashboard_tiles: PostgresTable = PostgresTable(access_scope="dashboard",# Child of dashboard: object-level access control applies to the parent dashboard, not the tile's own id.access_control_id_field="dashboard_id",+ description="Tiles placed on dashboards (insight, text, or button tiles) with their layout; one row per tile.",fields={- "id": IntegerDatabaseField(name="id"),+ "id": IntegerDatabaseField(name="id", description="Tile id."),"team_id": IntegerDatabaseField(name="team_id"),- "dashboard_id": IntegerDatabaseField(name="dashboard_id"),- "insight_id": IntegerDatabaseField(name="insight_id", nullable=True),- "text_id": IntegerDatabaseField(name="text_id", nullable=True),- "button_tile_id": StringDatabaseField(name="button_tile_id", nullable=True),- "layouts": StringJSONDatabaseField(name="layouts"),- "color": StringDatabaseField(name="color", nullable=True),- "show_description": BooleanDatabaseField(name="show_description", nullable=True),- "transparent_background": BooleanDatabaseField(name="transparent_background", nullable=True),- "filters_overrides": StringJSONDatabaseField(name="filters_overrides", nullable=True),+ "dashboard_id": IntegerDatabaseField(+ name="dashboard_id", description="Dashboard the tile belongs to; joins to dashboards.id."+ ),+ "insight_id": IntegerDatabaseField(+ name="insight_id",+ nullable=True,+ description="Insight shown by the tile; joins to insights.id (NULL for non-insight tiles).",+ ),+ "text_id": IntegerDatabaseField(+ name="text_id", nullable=True, description="Text content id for text tiles; NULL otherwise."+ ),+ "button_tile_id": StringDatabaseField(+ name="button_tile_id", nullable=True, description="Button content id for button tiles; NULL otherwise."+ ),+ "layouts": StringJSONDatabaseField(+ name="layouts", description="JSON grid layout (position/size) per breakpoint."+ ),+ "color": StringDatabaseField(name="color", nullable=True, description="Optional tile color."),+ "show_description": BooleanDatabaseField(+ name="show_description", nullable=True, description="Whether the insight description is shown on the tile."+ ),+ "transparent_background": BooleanDatabaseField(+ name="transparent_background",+ nullable=True,+ description="Whether the tile renders with a transparent background.",+ ),+ "filters_overrides": StringJSONDatabaseField(+ name="filters_overrides", nullable=True, description="JSON filter overrides applied to this tile only."+ ),"_deleted": BooleanDatabaseField(name="deleted", hidden=True, nullable=True),"deleted": ExpressionField(name="deleted",@@ -254,28 +387,51 @@ insights: PostgresTable = PostgresTable(name="insights",postgres_table_name="posthog_dashboarditem",access_scope="insight",+ description="Saved insights (the model is historically named 'dashboarditem'); one row per insight, including its query definition.",fields={- "id": IntegerDatabaseField(name="id"),- "short_id": StringDatabaseField(name="short_id"),+ "id": IntegerDatabaseField(name="id", description="Insight id."),+ "short_id": StringDatabaseField(name="short_id", description="Short URL-safe id used in insight links."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),- "description": StringDatabaseField(name="description"),- "filters": StringJSONDatabaseField(name="filters"),- "query": StringJSONDatabaseField(name="query"),- "query_metadata": StringJSONDatabaseField(name="query_metadata"),+ "name": StringDatabaseField(name="name", description="Insight name."),+ "description": StringDatabaseField(name="description", description="Insight description."),+ "filters": StringJSONDatabaseField(name="filters", description="Legacy JSON filter-based insight definition."),+ "query": StringJSONDatabaseField(+ name="query", description="JSON query (HogQL query schema) defining the insight."+ ),+ "query_metadata": StringJSONDatabaseField(+ name="query_metadata", description="JSON metadata derived from the query."+ ),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the insight has been deleted, 0 otherwise.",+ ),"_saved": BooleanDatabaseField(name="saved", hidden=True),- "saved": ExpressionField(name="saved", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_saved"])])),+ "saved": ExpressionField(+ name="saved",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_saved"])]),+ description="1 if explicitly saved by a user, 0 if a transient/auto-created insight.",+ ),"_favorited": BooleanDatabaseField(name="favorited", hidden=True),"favorited": ExpressionField(- name="favorited", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_favorited"])])+ name="favorited",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_favorited"])]),+ description="1 if the insight is marked as a favorite, 0 otherwise.",+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the insight was created."),+ "created_by_id": IntegerDatabaseField(+ name="created_by_id", nullable=True, description="User who created the insight."+ ),+ "last_modified_at": DateTimeDatabaseField(+ name="last_modified_at", description="When the insight definition was last changed."+ ),+ "last_modified_by_id": IntegerDatabaseField(+ name="last_modified_by_id", nullable=True, description="User who last modified the insight."+ ),+ "updated_at": DateTimeDatabaseField(+ name="updated_at", description="When the row was last updated (any field)."),- "created_at": DateTimeDatabaseField(name="created_at"),- "created_by_id": IntegerDatabaseField(name="created_by_id", nullable=True),- "last_modified_at": DateTimeDatabaseField(name="last_modified_at"),- "last_modified_by_id": IntegerDatabaseField(name="last_modified_by_id", nullable=True),- "updated_at": DateTimeDatabaseField(name="updated_at"),},)@@ -283,22 +439,36 @@ experiments: PostgresTable = PostgresTable(name="experiments",postgres_table_name="posthog_experiment",access_scope="experiment",+ description="A/B test experiments; one row per experiment, linked to the feature flag that controls variant assignment.",fields={- "id": IntegerDatabaseField(name="id"),+ "id": IntegerDatabaseField(name="id", description="Experiment id."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),- "description": StringDatabaseField(name="description"),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),- "filters": StringJSONDatabaseField(name="filters"),- "parameters": StringJSONDatabaseField(name="parameters"),- "start_date": DateTimeDatabaseField(name="start_date"),- "end_date": DateTimeDatabaseField(name="end_date"),+ "name": StringDatabaseField(name="name", description="Experiment name."),+ "description": StringDatabaseField(name="description", description="Experiment description/hypothesis."),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the experiment was created."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the experiment was last updated."),+ "filters": StringJSONDatabaseField(+ name="filters", description="JSON definition of the experiment's goal metric filters."+ ),+ "parameters": StringJSONDatabaseField(+ name="parameters", description="JSON experiment parameters (variants, exposure, etc.)."+ ),+ "start_date": DateTimeDatabaseField(+ name="start_date", description="When the experiment was launched; NULL if not started."+ ),+ "end_date": DateTimeDatabaseField(+ name="end_date", description="When the experiment was concluded; NULL if still running."+ ),"_archived": BooleanDatabaseField(name="archived", hidden=True),"archived": ExpressionField(- name="archived", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_archived"])])+ name="archived",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_archived"])]),+ description="1 if the experiment is archived, 0 otherwise.",+ ),+ "feature_flag_id": IntegerDatabaseField(+ name="feature_flag_id",+ description="Feature flag controlling variant assignment; joins to feature_flags.id.",),- "feature_flag_id": IntegerDatabaseField(name="feature_flag_id"),},)@@ -306,57 +476,91 @@ data_warehouse_sources: PostgresTable = PostgresTable(name="data_warehouse_sources",postgres_table_name="posthog_externaldatasource",access_scope="external_data_source",+ description="Configured data warehouse import sources (Stripe, Postgres, Hubspot, etc.); one row per connected source.",fields={- "id": IntegerDatabaseField(name="id"),+ "id": IntegerDatabaseField(name="id", description="Source id."),"team_id": IntegerDatabaseField(name="team_id"),- "source_type": StringDatabaseField(name="source_type"),- "prefix": StringDatabaseField(name="prefix"),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "source_type": StringDatabaseField(+ name="source_type", description="Source connector type, e.g. 'Stripe', 'Postgres', 'Hubspot'."+ ),+ "prefix": StringDatabaseField(+ name="prefix", description="Table-name prefix applied to all tables synced from this source."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the source was connected."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the source config was last updated."),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),- "deleted_at": DateTimeDatabaseField(name="deleted_at"),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the source has been deleted, 0 otherwise.",+ ),+ "deleted_at": DateTimeDatabaseField(+ name="deleted_at", description="When the source was deleted; NULL if not deleted."+ ),},)data_modeling_views: PostgresTable = PostgresTable(name="data_modeling_views",postgres_table_name="posthog_datawarehousesavedquery",+ description="Saved queries / data-modeling views built on top of warehouse data; one row per view, optionally materialized.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="View UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),- "status": StringDatabaseField(name="status"),- "columns": StringJSONDatabaseField(name="columns"),- "query": StringJSONDatabaseField(name="query"),- "last_run_at": DateTimeDatabaseField(name="last_run_at"),+ "name": StringDatabaseField(name="name", description="View name, used to reference it in queries."),+ "status": StringDatabaseField(+ name="status", description="Materialization status, e.g. Running, Completed, Failed."+ ),+ "columns": StringJSONDatabaseField(name="columns", description="JSON schema of the view's output columns."),+ "query": StringJSONDatabaseField(name="query", description="JSON HogQL query defining the view."),+ "last_run_at": DateTimeDatabaseField(+ name="last_run_at", description="When the view was last materialized/run."+ ),"_is_materialized": BooleanDatabaseField(name="is_materialized", hidden=True),"is_materialized": ExpressionField(- name="is_materialized", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_is_materialized"])])+ name="is_materialized",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_is_materialized"])]),+ description="1 if the view is materialized to a backing table, 0 if computed on the fly.",),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),- "deleted_at": DateTimeDatabaseField(name="deleted_at"),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the view has been deleted, 0 otherwise.",+ ),+ "deleted_at": DateTimeDatabaseField(+ name="deleted_at", description="When the view was deleted; NULL if not deleted."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the view was created."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the view was last updated."),},)data_warehouse_tables: PostgresTable = PostgresTable(name="data_warehouse_tables",postgres_table_name="posthog_datawarehousetable",+ description="Tables synced into the data warehouse from external sources; one row per warehouse table.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Warehouse table UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),- "columns": StringJSONDatabaseField(name="columns"),- "row_count": IntegerDatabaseField(name="row_count"),- "external_data_source_id": StringDatabaseField(name="external_data_source_id"),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "name": StringDatabaseField(name="name", description="Warehouse table name (includes the source prefix)."),+ "columns": StringJSONDatabaseField(name="columns", description="JSON schema of the table's columns."),+ "row_count": IntegerDatabaseField(name="row_count", description="Approximate number of rows in the table."),+ "external_data_source_id": StringDatabaseField(+ name="external_data_source_id",+ description="Source that produced this table; joins to data_warehouse_sources.id.",+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the table was first synced."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the table metadata was last updated."),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),- "deleted_at": DateTimeDatabaseField(name="deleted_at"),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the table has been deleted, 0 otherwise.",+ ),+ "deleted_at": DateTimeDatabaseField(+ name="deleted_at", description="When the table was deleted; NULL if not deleted."+ ),},)@@ -366,22 +570,39 @@ source_schemas: PostgresTable = PostgresTable(access_scope="external_data_source",# Child of external_data_source: object-level access control applies to the parent source, not the schema's own id.access_control_id_field="source_id",+ description="Per-table sync configuration within a data warehouse source (which table to import and how); one row per source table.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Schema UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),- "source_id": StringDatabaseField(name="source_id"),- "table_id": StringDatabaseField(name="table_id"),- "should_sync": BooleanDatabaseField(name="should_sync"),- "status": StringDatabaseField(name="status"),- "sync_type": StringDatabaseField(name="sync_type"),- "last_synced_at": DateTimeDatabaseField(name="last_synced_at"),- "latest_error": StringDatabaseField(name="latest_error"),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "name": StringDatabaseField(name="name", description="Name of the table/endpoint in the external source."),+ "source_id": StringDatabaseField(+ name="source_id", description="Parent source; joins to data_warehouse_sources.id."+ ),+ "table_id": StringDatabaseField(+ name="table_id", description="Resulting warehouse table; joins to data_warehouse_tables.id."+ ),+ "should_sync": BooleanDatabaseField(+ name="should_sync", description="Whether this table is enabled for syncing."+ ),+ "status": StringDatabaseField(+ name="status", description="Latest sync status for this table, e.g. Running, Completed, Error."+ ),+ "sync_type": StringDatabaseField(+ name="sync_type", description="Sync strategy, e.g. 'full_refresh' or 'incremental'."+ ),+ "last_synced_at": DateTimeDatabaseField(+ name="last_synced_at", description="When this table last finished syncing."+ ),+ "latest_error": StringDatabaseField(name="latest_error", description="Most recent sync error message, if any."),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the schema config was created."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the schema config was last updated."),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),- "deleted_at": DateTimeDatabaseField(name="deleted_at"),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the schema config has been deleted, 0 otherwise.",+ ),+ "deleted_at": DateTimeDatabaseField(name="deleted_at", description="When it was deleted; NULL if not deleted."),},)@@ -391,18 +612,25 @@ source_sync_jobs: PostgresTable = PostgresTable(access_scope="external_data_source",# Child of external_data_source: object-level access control applies to the parent source, not the job's own id.access_control_id_field="pipeline_id",+ description="Data warehouse sync job runs; one row per sync attempt of a source schema, with rows synced and outcome.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Sync job UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "pipeline_id": StringDatabaseField(name="pipeline_id"),- "schema_id": StringDatabaseField(name="schema_id"),- "status": StringDatabaseField(name="status"),- "rows_synced": IntegerDatabaseField(name="rows_synced"),- "billable": BooleanDatabaseField(name="billable"),- "latest_error": StringDatabaseField(name="latest_error"),- "created_at": DateTimeDatabaseField(name="created_at"),- "finished_at": DateTimeDatabaseField(name="finished_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "pipeline_id": StringDatabaseField(+ name="pipeline_id", description="Source whose pipeline ran; joins to data_warehouse_sources.id."+ ),+ "schema_id": StringDatabaseField(+ name="schema_id", description="Source schema being synced; joins to source_schemas.id."+ ),+ "status": StringDatabaseField(name="status", description="Job status, e.g. Running, Completed, Failed."),+ "rows_synced": IntegerDatabaseField(name="rows_synced", description="Number of rows synced by this job."),+ "billable": BooleanDatabaseField(name="billable", description="Whether the rows synced count toward billing."),+ "latest_error": StringDatabaseField(name="latest_error", description="Error message if the job failed."),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the job started."),+ "finished_at": DateTimeDatabaseField(+ name="finished_at", description="When the job finished; NULL while running."+ ),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the job row was last updated."),},)@@ -412,20 +640,27 @@ endpoint_versions: PostgresTable = PostgresTable(access_scope="endpoint",# Child of endpoint: object-level access control applies to the parent endpoint, not the version's own id.access_control_id_field="endpoint_id",+ description="Versioned query definitions for data-modeling endpoints (saved, callable HogQL queries); one row per endpoint version.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Endpoint version UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "endpoint_id": StringDatabaseField(name="endpoint_id"),- "version": IntegerDatabaseField(name="version"),- "description": StringDatabaseField(name="description"),- "query": StringJSONDatabaseField(name="query"),- "data_freshness_seconds": IntegerDatabaseField(name="data_freshness_seconds"),- "created_at": DateTimeDatabaseField(name="created_at"),+ "endpoint_id": StringDatabaseField(+ name="endpoint_id", description="Parent endpoint; joins to data_modeling_endpoints.id."+ ),+ "version": IntegerDatabaseField(name="version", description="Version number within the endpoint."),+ "description": StringDatabaseField(name="description", description="Description of this endpoint version."),+ "query": StringJSONDatabaseField(name="query", description="JSON HogQL query executed by this version."),+ "data_freshness_seconds": IntegerDatabaseField(+ name="data_freshness_seconds", description="Max age, in seconds, of cached results before re-running."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When this version was created."),"_is_active": BooleanDatabaseField(name="is_active", hidden=True),"is_active": ExpressionField(- name="is_active", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_is_active"])])+ name="is_active",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_is_active"])]),+ description="1 if this is the currently served version, 0 otherwise.",),- "columns": StringJSONDatabaseField(name="columns"),+ "columns": StringJSONDatabaseField(name="columns", description="JSON schema of the version's output columns."),},)@@ -434,19 +669,29 @@ endpoints: PostgresTable = PostgresTable(postgres_table_name="endpoints_endpoint",predicates=[parse_expr("deleted != true")],access_scope="endpoint",+ description="Data-modeling endpoints: named, callable saved queries; one row per endpoint (deleted endpoints are excluded).",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Endpoint UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),+ "name": StringDatabaseField(name="name", description="Endpoint name, used to call it."),"_is_active": BooleanDatabaseField(name="is_active", hidden=True),"is_active": ExpressionField(- name="is_active", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_is_active"])])+ name="is_active",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_is_active"])]),+ description="1 if the endpoint is active and callable, 0 otherwise.",+ ),+ "current_version": IntegerDatabaseField(+ name="current_version",+ description="Version number currently served; joins to data_modeling_endpoint_versions.version.",+ ),+ "derived_from_insight": StringDatabaseField(+ name="derived_from_insight", description="Short id of the insight this endpoint was created from, if any."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the endpoint was created."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the endpoint was last updated."),+ "last_executed_at": DateTimeDatabaseField(+ name="last_executed_at", description="When the endpoint was last called/executed."),- "current_version": IntegerDatabaseField(name="current_version"),- "derived_from_insight": StringDatabaseField(name="derived_from_insight"),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),- "last_executed_at": DateTimeDatabaseField(name="last_executed_at"),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),"deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),},@@ -456,41 +701,65 @@ feature_flags: PostgresTable = PostgresTable(name="feature_flags",postgres_table_name="posthog_featureflag",access_scope="feature_flag",+ description="Feature flags; one row per flag, with its targeting filters and rollout configuration.",fields={- "id": IntegerDatabaseField(name="id"),+ "id": IntegerDatabaseField(name="id", description="Flag id."),"team_id": IntegerDatabaseField(name="team_id"),- "key": StringDatabaseField(name="key"),- "name": StringDatabaseField(name="name"),- "filters": StringJSONDatabaseField(name="filters"),- "rollout_percentage": IntegerDatabaseField(name="rollout_percentage"),- "created_at": DateTimeDatabaseField(name="created_at"),+ "key": StringDatabaseField(name="key", description="Flag key used by SDKs to evaluate the flag."),+ "name": StringDatabaseField(name="name", description="Human-readable flag name/description."),+ "filters": StringJSONDatabaseField(+ name="filters", description="JSON targeting rules, variants, and release conditions."+ ),+ "rollout_percentage": IntegerDatabaseField(+ name="rollout_percentage",+ description="Top-level rollout percentage (0-100); detailed rules live in filters.",+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the flag was created."),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the flag has been deleted, 0 otherwise.",+ ),},)groups: PostgresTable = PostgresTable(name="groups",postgres_table_name="posthog_group",+ description="Group analytics entities (e.g. companies, projects); one row per group instance.",fields={- "id": IntegerDatabaseField(name="id"),+ "id": IntegerDatabaseField(name="id", description="Internal group row id."),"team_id": IntegerDatabaseField(name="team_id"),- "group_key": StringDatabaseField(name="group_key"),- "group_type_index": IntegerDatabaseField(name="group_type_index"),- "group_properties": StringJSONDatabaseField(name="group_properties"),- "created_at": DateTimeDatabaseField(name="created_at"),+ "group_key": StringDatabaseField(+ name="group_key", description="Identifier of the group within its type, e.g. a company id."+ ),+ "group_type_index": IntegerDatabaseField(+ name="group_type_index", description="Which group type (0-4) this group belongs to."+ ),+ "group_properties": StringJSONDatabaseField(+ name="group_properties", description="JSON map of the group's properties."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the group was first seen."),},)group_type_mappings: PostgresTable = PostgresTable(name="group_type_mappings",postgres_table_name="posthog_grouptypemapping",+ description="Mapping of group type indexes (0-4) to their names; one row per configured group type.",fields={- "id": IntegerDatabaseField(name="id"),+ "id": IntegerDatabaseField(name="id", description="Mapping row id."),"team_id": IntegerDatabaseField(name="team_id"),- "group_type": StringDatabaseField(name="group_type"),- "name_singular": StringDatabaseField(name="name_singular"),- "name_plural": StringDatabaseField(name="name_plural"),+ "group_type": StringDatabaseField(+ name="group_type", description="Name of the group type, e.g. 'company' or 'project'."+ ),+ "name_singular": StringDatabaseField(+ name="name_singular", description="Singular display label, e.g. 'organization'."+ ),+ "name_plural": StringDatabaseField(+ name="name_plural", description="Plural display label, e.g. 'organizations'."+ ),},)@@ -498,15 +767,20 @@ integrations: PostgresTable = PostgresTable(name="integrations",postgres_table_name="posthog_integration",access_scope="integration",+ description="Third-party integrations connected to the project (Slack, GitHub, etc.); one row per integration.",fields={- "id": IntegerDatabaseField(name="id"),+ "id": IntegerDatabaseField(name="id", description="Integration id."),"team_id": IntegerDatabaseField(name="team_id"),- "kind": StringDatabaseField(name="kind"),- "integration_id": StringDatabaseField(name="integration_id"),- "config": StringJSONDatabaseField(name="config"),- "errors": StringDatabaseField(name="errors"),- "created_at": DateTimeDatabaseField(name="created_at"),- "created_by_id": IntegerDatabaseField(name="created_by_id"),+ "kind": StringDatabaseField(name="kind", description="Integration type, e.g. 'slack', 'github', 'salesforce'."),+ "integration_id": StringDatabaseField(+ name="integration_id", description="Identifier of the account/workspace in the external system."+ ),+ "config": StringJSONDatabaseField(name="config", description="JSON non-sensitive integration config."),+ "errors": StringDatabaseField(+ name="errors", description="Most recent error encountered using the integration."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the integration was connected."),+ "created_by_id": IntegerDatabaseField(name="created_by_id", description="User who connected the integration."),},)@@ -514,37 +788,59 @@ integration_repository_cache: PostgresTable = PostgresTable(name="integration_repository_cache",postgres_table_name="posthog_integrationrepositorycacheentry",access_scope="integration",+ description="Cached metadata about GitHub repositories accessible via an integration; one row per repository.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Cache entry UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "integration_id": IntegerDatabaseField(name="integration_id", nullable=True),- "user_integration_id": IntegerDatabaseField(name="user_integration_id", nullable=True),- "full_name": StringDatabaseField(name="full_name"),- "description": StringDatabaseField(name="description", nullable=True),- "topics": StringJSONDatabaseField(name="topics"),- "archived": BooleanDatabaseField(name="archived"),- "fork": BooleanDatabaseField(name="fork"),- "primary_language": StringDatabaseField(name="primary_language", nullable=True),- "default_branch": StringDatabaseField(name="default_branch"),- "default_branch_sha": StringDatabaseField(name="default_branch_sha"),- "readme": StringDatabaseField(name="readme"),- "tree_paths": StringDatabaseField(name="tree_paths"),- "tree_truncated": BooleanDatabaseField(name="tree_truncated"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "integration_id": IntegerDatabaseField(+ name="integration_id",+ nullable=True,+ description="Org-level integration this repo belongs to; joins to integrations.id.",+ ),+ "user_integration_id": IntegerDatabaseField(+ name="user_integration_id", nullable=True, description="User-level integration this repo belongs to."+ ),+ "full_name": StringDatabaseField(name="full_name", description="Repository full name, e.g. 'owner/repo'."),+ "description": StringDatabaseField(name="description", nullable=True, description="Repository description."),+ "topics": StringJSONDatabaseField(name="topics", description="JSON array of repository topics/tags."),+ "archived": BooleanDatabaseField(name="archived", description="Whether the repository is archived on GitHub."),+ "fork": BooleanDatabaseField(name="fork", description="Whether the repository is a fork."),+ "primary_language": StringDatabaseField(+ name="primary_language", nullable=True, description="Primary programming language."+ ),+ "default_branch": StringDatabaseField(name="default_branch", description="Default branch name, e.g. 'main'."),+ "default_branch_sha": StringDatabaseField(+ name="default_branch_sha", description="Commit SHA at the head of the default branch."+ ),+ "readme": StringDatabaseField(name="readme", description="Cached README contents."),+ "tree_paths": StringDatabaseField(+ name="tree_paths", description="Cached list of file paths in the repository tree."+ ),+ "tree_truncated": BooleanDatabaseField(+ name="tree_truncated", description="Whether the cached file tree was truncated."+ ),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the cache entry was last refreshed."),},)insight_variables: PostgresTable = PostgresTable(name="insight_variables",postgres_table_name="posthog_insightvariable",+ description="Reusable insight/dashboard template variables; one row per variable.",fields={- "id": IntegerDatabaseField(name="id"),+ "id": IntegerDatabaseField(name="id", description="Variable id."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),- "type": StringDatabaseField(name="type"),- "code_name": StringDatabaseField(name="code_name"),- "values": StringJSONDatabaseField(name="values"),- "default_value": StringJSONDatabaseField(name="default_value"),+ "name": StringDatabaseField(name="name", description="Display name of the variable."),+ "type": StringDatabaseField(name="type", description="Variable type, e.g. 'String', 'Number', 'List', 'Date'."),+ "code_name": StringDatabaseField(+ name="code_name", description="Identifier used to reference the variable in queries."+ ),+ "values": StringJSONDatabaseField(+ name="values", description="JSON list of allowed values, for list-type variables."+ ),+ "default_value": StringJSONDatabaseField(+ name="default_value", description="JSON default value of the variable."+ ),},)@@ -552,23 +848,42 @@ session_recording_playlists: PostgresTable = PostgresTable(name="session_recording_playlists",postgres_table_name="posthog_sessionrecordingplaylist",access_scope="session_recording_playlist",+ description="Saved playlists/collections of session recordings, defined by filters or pinned recordings; one row per playlist.",fields={- "id": IntegerDatabaseField(name="id"),- "short_id": StringDatabaseField(name="short_id"),- "name": StringDatabaseField(name="name"),- "derived_name": StringDatabaseField(name="derived_name"),- "description": StringDatabaseField(name="description"),+ "id": IntegerDatabaseField(name="id", description="Playlist id."),+ "short_id": StringDatabaseField(name="short_id", description="Short URL-safe id used in playlist links."),+ "name": StringDatabaseField(name="name", description="User-given playlist name."),+ "derived_name": StringDatabaseField(+ name="derived_name", description="Auto-generated name used when no name is set."+ ),+ "description": StringDatabaseField(name="description", description="Playlist description."),"team_id": IntegerDatabaseField(name="team_id"),"_pinned": BooleanDatabaseField(name="pinned", hidden=True),- "pinned": ExpressionField(name="pinned", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_pinned"])])),+ "pinned": ExpressionField(+ name="pinned",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_pinned"])]),+ description="1 if the playlist is pinned, 0 otherwise.",+ ),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),- "filters": StringJSONDatabaseField(name="filters"),- "type": StringDatabaseField(name="type"),- "created_at": DateTimeDatabaseField(name="created_at"),- "created_by_id": IntegerDatabaseField(name="created_by_id"),- "last_modified_at": DateTimeDatabaseField(name="last_modified_at"),- "last_modified_by_id": IntegerDatabaseField(name="last_modified_by_id"),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the playlist has been deleted, 0 otherwise.",+ ),+ "filters": StringJSONDatabaseField(+ name="filters", description="JSON filters defining which recordings are in the playlist."+ ),+ "type": StringDatabaseField(+ name="type", description="Playlist type, e.g. filter-based or a collection of pinned recordings."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the playlist was created."),+ "created_by_id": IntegerDatabaseField(name="created_by_id", description="User who created the playlist."),+ "last_modified_at": DateTimeDatabaseField(+ name="last_modified_at", description="When the playlist was last modified."+ ),+ "last_modified_by_id": IntegerDatabaseField(+ name="last_modified_by_id", description="User who last modified the playlist."+ ),},)@@ -576,28 +891,51 @@ session_recordings: PostgresTable = PostgresTable(name="session_recordings",postgres_table_name="posthog_sessionrecording",access_scope="session_recording",+ description="Session recording metadata (durations, activity counts); one row per recorded session. The recording payload itself lives in object storage, not here.",fields={- "id": StringDatabaseField(name="id"),- "session_id": StringDatabaseField(name="session_id"),+ "id": StringDatabaseField(name="id", description="Recording row UUID."),+ "session_id": StringDatabaseField(+ name="session_id", description="Session identifier; matches events.$session_id."+ ),"team_id": IntegerDatabaseField(name="team_id"),- "distinct_id": StringDatabaseField(name="distinct_id"),- "duration": IntegerDatabaseField(name="duration"),- "active_seconds": IntegerDatabaseField(name="active_seconds"),- "inactive_seconds": IntegerDatabaseField(name="inactive_seconds"),- "start_time": DateTimeDatabaseField(name="start_time"),- "end_time": DateTimeDatabaseField(name="end_time"),- "click_count": IntegerDatabaseField(name="click_count"),- "keypress_count": IntegerDatabaseField(name="keypress_count"),- "mouse_activity_count": IntegerDatabaseField(name="mouse_activity_count"),- "console_log_count": IntegerDatabaseField(name="console_log_count"),- "console_warn_count": IntegerDatabaseField(name="console_warn_count"),- "console_error_count": IntegerDatabaseField(name="console_error_count"),- "start_url": StringDatabaseField(name="start_url"),+ "distinct_id": StringDatabaseField(name="distinct_id", description="Distinct id of the user/device recorded."),+ "duration": IntegerDatabaseField(+ name="duration", description="Total recording length in seconds (active + inactive)."+ ),+ "active_seconds": IntegerDatabaseField(name="active_seconds", description="Seconds of active user engagement."),+ "inactive_seconds": IntegerDatabaseField(name="inactive_seconds", description="Seconds with no user activity."),+ "start_time": DateTimeDatabaseField(name="start_time", description="When the recording started."),+ "end_time": DateTimeDatabaseField(name="end_time", description="When the recording ended."),+ "click_count": IntegerDatabaseField(name="click_count", description="Number of clicks captured."),+ "keypress_count": IntegerDatabaseField(name="keypress_count", description="Number of keypresses captured."),+ "mouse_activity_count": IntegerDatabaseField(+ name="mouse_activity_count", description="Number of mouse-activity events captured."+ ),+ "console_log_count": IntegerDatabaseField(+ name="console_log_count", description="Number of console.log messages captured."+ ),+ "console_warn_count": IntegerDatabaseField(+ name="console_warn_count", description="Number of console.warn messages captured."+ ),+ "console_error_count": IntegerDatabaseField(+ name="console_error_count", description="Number of console.error messages captured."+ ),+ "start_url": StringDatabaseField(name="start_url", description="URL where the recording started."),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),- "created_at": DateTimeDatabaseField(name="created_at"),- "retention_period_days": IntegerDatabaseField(name="retention_period_days"),- "storage_version": StringDatabaseField(name="storage_version"),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the recording has been deleted, 0 otherwise.",+ ),+ "created_at": DateTimeDatabaseField(+ name="created_at", description="When the recording metadata row was created."+ ),+ "retention_period_days": IntegerDatabaseField(+ name="retention_period_days", description="How long the recording is retained, in days."+ ),+ "storage_version": StringDatabaseField(+ name="storage_version", description="Storage format version of the recording payload."+ ),},)@@ -605,42 +943,55 @@ surveys: PostgresTable = PostgresTable(name="surveys",postgres_table_name="posthog_survey",access_scope="survey",+ description="In-app surveys; one row per survey, including its questions and display configuration.",fields={- "id": IntegerDatabaseField(name="id"),+ "id": IntegerDatabaseField(name="id", description="Survey id."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),- "type": StringDatabaseField(name="type"),- "questions": StringJSONDatabaseField(name="questions"),- "appearance": StringJSONDatabaseField(name="appearance"),- "start_date": DateTimeDatabaseField(name="start_date"),- "end_date": DateTimeDatabaseField(name="end_date"),- "created_at": DateTimeDatabaseField(name="created_at"),+ "name": StringDatabaseField(name="name", description="Survey name."),+ "type": StringDatabaseField(name="type", description="Survey delivery type, e.g. 'popover', 'api', 'widget'."),+ "questions": StringJSONDatabaseField(name="questions", description="JSON array of the survey's questions."),+ "appearance": StringJSONDatabaseField(name="appearance", description="JSON styling/appearance configuration."),+ "start_date": DateTimeDatabaseField(+ name="start_date", description="When the survey was launched; NULL if not started."+ ),+ "end_date": DateTimeDatabaseField(+ name="end_date", description="When the survey was stopped; NULL if still running."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the survey was created."),},)teams: PostgresTable = PostgresTable(name="teams",postgres_table_name="posthog_team",+ description="Projects/teams (a PostHog 'team' is a project); typically just the caller's own team.",fields={- "id": IntegerDatabaseField(name="id"),- "team_id": IntegerDatabaseField(name="id"),- "name": StringDatabaseField(name="name"),- "timezone": StringDatabaseField(name="timezone"),- "test_account_filters": StringJSONDatabaseField(name="test_account_filters"),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "id": IntegerDatabaseField(name="id", description="Team/project id."),+ "team_id": IntegerDatabaseField(name="id", description="Alias of id for consistency with other tables."),+ "name": StringDatabaseField(name="name", description="Project name."),+ "timezone": StringDatabaseField(name="timezone", description="Project timezone used for date bucketing."),+ "test_account_filters": StringJSONDatabaseField(+ name="test_account_filters", description="JSON filters defining internal/test accounts to exclude."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the project was created."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the project was last updated."),},)exports: PostgresTable = PostgresTable(name="exports",postgres_table_name="posthog_exportedasset",+ description="One-off exported assets (CSV/PNG/PDF of insights, etc.); one row per exported asset.",fields={- "id": IntegerDatabaseField(name="id"),+ "id": IntegerDatabaseField(name="id", description="Exported asset id."),"team_id": IntegerDatabaseField(name="team_id"),- "export_format": StringDatabaseField(name="export_format"),- "created_at": DateTimeDatabaseField(name="created_at"),- "export_context": StringJSONDatabaseField(name="export_context"),+ "export_format": StringDatabaseField(+ name="export_format", description="MIME type of the export, e.g. 'text/csv', 'image/png'."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the export was created."),+ "export_context": StringJSONDatabaseField(+ name="export_context", description="JSON describing what was exported (query, source, etc.)."+ ),},)@@ -650,19 +1001,28 @@ exports: PostgresTable = PostgresTable(file_system: PostgresTable = PostgresTable(name="file_system",postgres_table_name="posthog_filesystem",+ description="The project's virtual file tree backing the navigation/'products' UI; one row per node (folder or item) addressed by path.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="File-system node UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "path": StringDatabaseField(name="path"),- "depth": IntegerDatabaseField(name="depth", nullable=True),- "type": StringDatabaseField(name="type"),- "ref": StringDatabaseField(name="ref", nullable=True),- "href": StringDatabaseField(name="href", nullable=True),- "meta": StringJSONDatabaseField(name="meta", nullable=True),- "surface": StringDatabaseField(name="surface", nullable=True),- "shortcut": BooleanDatabaseField(name="shortcut", nullable=True),- "created_at": DateTimeDatabaseField(name="created_at"),- "created_by_id": IntegerDatabaseField(name="created_by_id", nullable=True),+ "path": StringDatabaseField(name="path", description="Slash-delimited path of the node in the tree."),+ "depth": IntegerDatabaseField(name="depth", nullable=True, description="Number of path segments (tree depth)."),+ "type": StringDatabaseField(name="type", description="Node type, e.g. a folder or a specific item kind."),+ "ref": StringDatabaseField(+ name="ref", nullable=True, description="Id of the underlying object the node points to."+ ),+ "href": StringDatabaseField(name="href", nullable=True, description="URL the node links to in the app."),+ "meta": StringJSONDatabaseField(name="meta", nullable=True, description="JSON metadata about the node."),+ "surface": StringDatabaseField(+ name="surface", nullable=True, description="Product surface the node belongs to, e.g. 'web' or 'desktop'."+ ),+ "shortcut": BooleanDatabaseField(+ name="shortcut", nullable=True, description="Whether the node is a shortcut to another node."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the node was created."),+ "created_by_id": IntegerDatabaseField(+ name="created_by_id", nullable=True, description="User who created the node."+ ),},)@@ -670,14 +1030,21 @@ activity_logs: PostgresTable = PostgresTable(name="activity_logs",postgres_table_name="posthog_activitylog",access_scope="activity_log",+ description="Audit trail of changes to objects (insights, flags, dashboards, etc.); one row per logged activity.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Activity log entry UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "activity": StringDatabaseField(name="activity"),- "item_id": StringDatabaseField(name="item_id"),- "scope": StringDatabaseField(name="scope"),- "detail": StringJSONDatabaseField(name="detail"),- "created_at": DateTimeDatabaseField(name="created_at"),+ "activity": StringDatabaseField(+ name="activity", description="Action performed, e.g. 'created', 'updated', 'deleted'."+ ),+ "item_id": StringDatabaseField(name="item_id", description="Id of the object the activity is about."),+ "scope": StringDatabaseField(+ name="scope", description="Type of object affected, e.g. 'Insight', 'FeatureFlag', 'Dashboard'."+ ),+ "detail": StringJSONDatabaseField(+ name="detail", description="JSON detail of what changed (field-level diffs, context)."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the activity occurred."),},)@@ -685,16 +1052,23 @@ actions: PostgresTable = PostgresTable(name="actions",postgres_table_name="posthog_action",access_scope="action",+ description="Actions: named event matchers that group raw events into meaningful user actions; one row per action.",fields={- "id": IntegerDatabaseField(name="id"),+ "id": IntegerDatabaseField(name="id", description="Action id."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),- "description": StringDatabaseField(name="description"),+ "name": StringDatabaseField(name="name", description="Action name."),+ "description": StringDatabaseField(name="description", description="Action description."),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),- "steps_json": StringJSONDatabaseField(name="steps_json"),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the action has been deleted, 0 otherwise.",+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the action was created."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the action was last updated."),+ "steps_json": StringJSONDatabaseField(+ name="steps_json", description="JSON array of match steps (event/selector/url conditions)."+ ),},)@@ -702,20 +1076,43 @@ annotations: PostgresTable = PostgresTable(name="annotations",postgres_table_name="posthog_annotation",access_scope="annotation",+ description="Annotations: dated notes overlaid on insight/dashboard charts; one row per annotation.",fields={- "id": IntegerDatabaseField(name="id"),+ "id": IntegerDatabaseField(name="id", description="Annotation id."),"team_id": IntegerDatabaseField(name="team_id"),- "content": StringDatabaseField(name="content", nullable=True),- "scope": StringDatabaseField(name="scope"),- "creation_type": StringDatabaseField(name="creation_type"),- "date_marker": DateTimeDatabaseField(name="date_marker", nullable=True),+ "content": StringDatabaseField(name="content", nullable=True, description="Annotation text."),+ "scope": StringDatabaseField(+ name="scope", description="Where the annotation applies, e.g. 'project', 'dashboard', 'insight'."+ ),+ "creation_type": StringDatabaseField(+ name="creation_type", description="How the annotation was created, e.g. user-created vs GitHub."+ ),+ "date_marker": DateTimeDatabaseField(+ name="date_marker", nullable=True, description="The point in time the annotation marks on a chart."+ ),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),- "dashboard_item_id": IntegerDatabaseField(name="dashboard_item_id", nullable=True),- "dashboard_id": IntegerDatabaseField(name="dashboard_id", nullable=True),- "created_by_id": IntegerDatabaseField(name="created_by_id", nullable=True),- "created_at": DateTimeDatabaseField(name="created_at", nullable=True),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the annotation has been deleted, 0 otherwise.",+ ),+ "dashboard_item_id": IntegerDatabaseField(+ name="dashboard_item_id",+ nullable=True,+ description="Insight this annotation is scoped to; joins to insights.id.",+ ),+ "dashboard_id": IntegerDatabaseField(+ name="dashboard_id",+ nullable=True,+ description="Dashboard this annotation is scoped to; joins to dashboards.id.",+ ),+ "created_by_id": IntegerDatabaseField(+ name="created_by_id", nullable=True, description="User who created the annotation."+ ),+ "created_at": DateTimeDatabaseField(+ name="created_at", nullable=True, description="When the annotation was created."+ ),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the annotation was last updated."),},)@@ -723,19 +1120,24 @@ hog_flows: PostgresTable = PostgresTable(name="hog_flows",postgres_table_name="posthog_hogflow",access_scope="hog_flow",+ description="Hog flows: multi-step automation/messaging workflows; one row per flow, with its graph of actions and edges.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Flow UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),- "description": StringDatabaseField(name="description"),- "status": StringDatabaseField(name="status"),- "version": IntegerDatabaseField(name="version"),- "exit_condition": StringDatabaseField(name="exit_condition"),- "trigger": StringJSONDatabaseField(name="trigger"),- "edges": StringJSONDatabaseField(name="edges"),- "actions": StringJSONDatabaseField(name="actions"),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "name": StringDatabaseField(name="name", description="Flow name."),+ "description": StringDatabaseField(name="description", description="Flow description."),+ "status": StringDatabaseField(name="status", description="Flow status, e.g. 'active', 'draft', 'archived'."),+ "version": IntegerDatabaseField(name="version", description="Flow version number."),+ "exit_condition": StringDatabaseField(+ name="exit_condition", description="Condition that causes a person to exit the flow."+ ),+ "trigger": StringJSONDatabaseField(+ name="trigger", description="JSON definition of what enrolls people into the flow."+ ),+ "edges": StringJSONDatabaseField(name="edges", description="JSON edges connecting actions in the flow graph."),+ "actions": StringJSONDatabaseField(name="actions", description="JSON nodes/actions that make up the flow."),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the flow was created."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the flow was last updated."),},)@@ -743,23 +1145,42 @@ hog_functions: PostgresTable = PostgresTable(name="hog_functions",postgres_table_name="posthog_hogfunction",access_scope="hog_function",+ description="Hog functions: destinations/transformations in the CDP pipeline (written in Hog); one row per function.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Function UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),- "description": StringDatabaseField(name="description"),- "type": StringDatabaseField(name="type"),+ "name": StringDatabaseField(name="name", description="Function name."),+ "description": StringDatabaseField(name="description", description="Function description."),+ "type": StringDatabaseField(+ name="type", description="Function type, e.g. 'destination', 'transformation', 'site_app'."+ ),"_enabled": BooleanDatabaseField(name="enabled", hidden=True),- "enabled": ExpressionField(name="enabled", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_enabled"])])),+ "enabled": ExpressionField(+ name="enabled",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_enabled"])]),+ description="1 if the function is enabled, 0 otherwise.",+ ),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),- "icon_url": StringDatabaseField(name="icon_url"),- "template_id": StringDatabaseField(name="template_id"),- "execution_order": IntegerDatabaseField(name="execution_order"),- "inputs_schema": StringJSONDatabaseField(name="inputs_schema"),- "filters": StringJSONDatabaseField(name="filters"),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the function has been deleted, 0 otherwise.",+ ),+ "icon_url": StringDatabaseField(name="icon_url", description="URL of the function's icon."),+ "template_id": StringDatabaseField(+ name="template_id", description="Id of the template this function was created from."+ ),+ "execution_order": IntegerDatabaseField(+ name="execution_order", description="Order in which the function runs relative to others of its type."+ ),+ "inputs_schema": StringJSONDatabaseField(+ name="inputs_schema", description="JSON schema describing the function's configurable inputs."+ ),+ "filters": StringJSONDatabaseField(+ name="filters", description="JSON filters deciding which events the function runs on."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the function was created."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the function was last updated."),},)@@ -767,37 +1188,57 @@ notebooks: PostgresTable = PostgresTable(name="notebooks",postgres_table_name="posthog_notebook",access_scope="notebook",+ description="Notebooks: rich-text documents that embed insights, recordings, and queries; one row per notebook.",fields={- "id": StringDatabaseField(name="id"),- "short_id": StringDatabaseField(name="short_id"),+ "id": StringDatabaseField(name="id", description="Notebook UUID."),+ "short_id": StringDatabaseField(name="short_id", description="Short URL-safe id used in notebook links."),"team_id": IntegerDatabaseField(name="team_id"),- "title": StringDatabaseField(name="title"),- "content": StringJSONDatabaseField(name="content"),- "text_content": StringDatabaseField(name="text_content"),+ "title": StringDatabaseField(name="title", description="Notebook title."),+ "content": StringJSONDatabaseField(+ name="content", description="JSON rich-text document (ProseMirror) content."+ ),+ "text_content": StringDatabaseField(+ name="text_content", description="Plain-text rendering of the notebook, for search."+ ),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),- "visibility": StringDatabaseField(name="visibility"),- "version": IntegerDatabaseField(name="version"),- "created_at": DateTimeDatabaseField(name="created_at"),- "last_modified_at": DateTimeDatabaseField(name="last_modified_at"),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the notebook has been deleted, 0 otherwise.",+ ),+ "visibility": StringDatabaseField(+ name="visibility", description="Visibility setting, e.g. 'private' or shared."+ ),+ "version": IntegerDatabaseField(name="version", description="Notebook version number."),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the notebook was created."),+ "last_modified_at": DateTimeDatabaseField(+ name="last_modified_at", description="When the notebook was last modified."+ ),},)data_modeling_jobs: PostgresTable = PostgresTable(name="data_modeling_jobs",postgres_table_name="posthog_datamodelingjob",+ description="Materialization job runs for data-modeling views; one row per run that materializes a view.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Job UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "data_modeling_view_id": StringDatabaseField(name="saved_query_id"),- "status": StringDatabaseField(name="status"),- "rows_materialized": IntegerDatabaseField(name="rows_materialized"),- "rows_expected": IntegerDatabaseField(name="rows_expected"),- "error": StringDatabaseField(name="error"),- "storage_delta_mib": FloatDatabaseField(name="storage_delta_mib"),- "last_run_at": DateTimeDatabaseField(name="last_run_at"),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "data_modeling_view_id": StringDatabaseField(+ name="saved_query_id", description="View being materialized; joins to data_modeling_views.id."+ ),+ "status": StringDatabaseField(name="status", description="Job status, e.g. Running, Completed, Failed."),+ "rows_materialized": IntegerDatabaseField(+ name="rows_materialized", description="Number of rows written so far."+ ),+ "rows_expected": IntegerDatabaseField(name="rows_expected", description="Number of rows expected for the run."),+ "error": StringDatabaseField(name="error", description="Error message if the job failed."),+ "storage_delta_mib": FloatDatabaseField(+ name="storage_delta_mib", description="Change in materialized storage size, in MiB."+ ),+ "last_run_at": DateTimeDatabaseField(name="last_run_at", description="When the job last ran."),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the job was created."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the job row was last updated."),},)@@ -805,13 +1246,16 @@ error_tracking_issues: PostgresTable = PostgresTable(name="error_tracking_issues",postgres_table_name="posthog_errortrackingissue",access_scope="error_tracking",+ description="Error tracking issues: grouped exceptions/errors; one row per issue.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Issue UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "created_at": DateTimeDatabaseField(name="created_at"),- "status": StringDatabaseField(name="status"),- "name": StringDatabaseField(name="name"),- "description": StringDatabaseField(name="description"),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the issue was first created."),+ "status": StringDatabaseField(+ name="status", description="Issue status, e.g. 'active', 'resolved', 'suppressed'."+ ),+ "name": StringDatabaseField(name="name", description="Issue title (usually the exception type/message)."),+ "description": StringDatabaseField(name="description", description="Issue description."),},)@@ -819,12 +1263,19 @@ error_tracking_issue_assignments: PostgresTable = PostgresTable(name="error_tracking_issue_assignments",postgres_table_name="posthog_errortrackingissueassignment",access_scope="error_tracking",+ description="Assignments of error tracking issues to a user or role; one row per assignment.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Assignment UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "issue_id": StringDatabaseField(name="issue_id"),- "user_id": IntegerDatabaseField(name="user_id"),- "role_id": StringDatabaseField(name="role_id"),+ "issue_id": StringDatabaseField(+ name="issue_id", description="Issue assigned; joins to error_tracking_issues.id."+ ),+ "user_id": IntegerDatabaseField(+ name="user_id", description="User the issue is assigned to (if assigned to a user)."+ ),+ "role_id": StringDatabaseField(+ name="role_id", description="Role the issue is assigned to (if assigned to a role)."+ ),},)@@ -832,12 +1283,17 @@ error_tracking_issue_fingerprints: PostgresTable = PostgresTable(name="error_tracking_issue_fingerprints",postgres_table_name="posthog_errortrackingissuefingerprintv2",access_scope="error_tracking",+ description="Fingerprints that map individual exceptions to an issue (the grouping key); one row per fingerprint.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Fingerprint row UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "issue_id": StringDatabaseField(name="issue_id"),- "fingerprint": StringDatabaseField(name="fingerprint"),- "first_seen": DateTimeDatabaseField(name="first_seen"),+ "issue_id": StringDatabaseField(+ name="issue_id", description="Issue this fingerprint belongs to; joins to error_tracking_issues.id."+ ),+ "fingerprint": StringDatabaseField(+ name="fingerprint", description="Hash that groups matching exceptions into the issue."+ ),+ "first_seen": DateTimeDatabaseField(name="first_seen", description="When this fingerprint was first seen."),},)@@ -845,17 +1301,26 @@ error_tracking_assignment_rules: PostgresTable = PostgresTable(name="error_tracking_assignment_rules",postgres_table_name="posthog_errortrackingassignmentrule",access_scope="error_tracking",+ description="Rules that auto-assign new error tracking issues to a user or role based on filters; one row per rule.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Rule UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "user_id": IntegerDatabaseField(name="user_id", nullable=True),- "role_id": StringDatabaseField(name="role_id", nullable=True),- "order_key": IntegerDatabaseField(name="order_key"),- "filters": StringJSONDatabaseField(name="filters"),- "bytecode": StringJSONDatabaseField(name="bytecode"),- "disabled_data": StringJSONDatabaseField(name="disabled_data", nullable=True),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "user_id": IntegerDatabaseField(+ name="user_id", nullable=True, description="User matched issues are assigned to."+ ),+ "role_id": StringDatabaseField(+ name="role_id", nullable=True, description="Role matched issues are assigned to."+ ),+ "order_key": IntegerDatabaseField(name="order_key", description="Evaluation order; lower runs first."),+ "filters": StringJSONDatabaseField(+ name="filters", description="JSON conditions an issue must match for the rule to apply."+ ),+ "bytecode": StringJSONDatabaseField(name="bytecode", description="Compiled Hog bytecode for the filters."),+ "disabled_data": StringJSONDatabaseField(+ name="disabled_data", nullable=True, description="JSON state when the rule is disabled; NULL when active."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the rule was created."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the rule was last updated."),},)@@ -863,16 +1328,25 @@ error_tracking_suppression_rules: PostgresTable = PostgresTable(name="error_tracking_suppression_rules",postgres_table_name="posthog_errortrackingsuppressionrule",access_scope="error_tracking",+ description="Rules that suppress or sample matching exceptions before they create issues; one row per rule.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Rule UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "order_key": IntegerDatabaseField(name="order_key"),- "sampling_rate": FloatDatabaseField(name="sampling_rate"),- "filters": StringJSONDatabaseField(name="filters"),- "bytecode": StringJSONDatabaseField(name="bytecode", nullable=True),- "disabled_data": StringJSONDatabaseField(name="disabled_data", nullable=True),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "order_key": IntegerDatabaseField(name="order_key", description="Evaluation order; lower runs first."),+ "sampling_rate": FloatDatabaseField(+ name="sampling_rate", description="Fraction (0-1) of matching exceptions to keep; the rest are suppressed."+ ),+ "filters": StringJSONDatabaseField(+ name="filters", description="JSON conditions an exception must match for the rule to apply."+ ),+ "bytecode": StringJSONDatabaseField(+ name="bytecode", nullable=True, description="Compiled Hog bytecode for the filters."+ ),+ "disabled_data": StringJSONDatabaseField(+ name="disabled_data", nullable=True, description="JSON state when the rule is disabled; NULL when active."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the rule was created."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the rule was last updated."),},)@@ -880,14 +1354,17 @@ error_tracking_releases: PostgresTable = PostgresTable(name="error_tracking_releases",postgres_table_name="posthog_errortrackingrelease",access_scope="error_tracking",+ description="Code releases tracked for error attribution and source-map matching; one row per release.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Release UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "hash_id": StringDatabaseField(name="hash_id"),- "version": StringDatabaseField(name="version"),- "project": StringDatabaseField(name="project"),- "metadata": StringJSONDatabaseField(name="metadata", nullable=True),- "created_at": DateTimeDatabaseField(name="created_at"),+ "hash_id": StringDatabaseField(name="hash_id", description="Hash identifying the release build."),+ "version": StringDatabaseField(name="version", description="Human-readable release version."),+ "project": StringDatabaseField(name="project", description="Project/app the release belongs to."),+ "metadata": StringJSONDatabaseField(+ name="metadata", nullable=True, description="JSON metadata about the release."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the release was recorded."),},)@@ -895,14 +1372,25 @@ error_tracking_symbol_sets: PostgresTable = PostgresTable(name="error_tracking_symbol_sets",postgres_table_name="posthog_errortrackingsymbolset",access_scope="error_tracking",+ description="Symbol sets (source maps / debug symbols) used to symbolicate stack traces; one row per symbol set.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Symbol set UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "ref": StringDatabaseField(name="ref"),- "release_id": StringDatabaseField(name="release_id", nullable=True),- "created_at": DateTimeDatabaseField(name="created_at"),- "last_used": DateTimeDatabaseField(name="last_used", nullable=True),- "failure_reason": StringDatabaseField(name="failure_reason", nullable=True),+ "ref": StringDatabaseField(+ name="ref", description="Reference identifying the symbol set, e.g. a chunk/file id."+ ),+ "release_id": StringDatabaseField(+ name="release_id",+ nullable=True,+ description="Release this symbol set belongs to; joins to error_tracking_releases.id.",+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the symbol set was uploaded."),+ "last_used": DateTimeDatabaseField(+ name="last_used", nullable=True, description="When the symbol set was last used to symbolicate."+ ),+ "failure_reason": StringDatabaseField(+ name="failure_reason", nullable=True, description="Why symbolication with this set failed, if applicable."+ ),},)@@ -910,16 +1398,21 @@ logs_views: PostgresTable = PostgresTable(name="logs_views",postgres_table_name="logs_logsview",access_scope="logs",+ description="Saved log explorer views (saved filter sets for logs); one row per saved view.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="View UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "short_id": StringDatabaseField(name="short_id"),- "name": StringDatabaseField(name="name"),- "filters": StringJSONDatabaseField(name="filters"),+ "short_id": StringDatabaseField(name="short_id", description="Short URL-safe id used in view links."),+ "name": StringDatabaseField(name="name", description="View name."),+ "filters": StringJSONDatabaseField(name="filters", description="JSON log filters defining the view."),"_pinned": BooleanDatabaseField(name="pinned", hidden=True),- "pinned": ExpressionField(name="pinned", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_pinned"])])),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "pinned": ExpressionField(+ name="pinned",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_pinned"])]),+ description="1 if the view is pinned, 0 otherwise.",+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the view was created."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the view was last updated."),},)@@ -927,28 +1420,59 @@ logs_alerts: PostgresTable = PostgresTable(name="logs_alerts",postgres_table_name="logs_logsalertconfiguration",access_scope="logs",+ description="Alerts that fire when matching log volume crosses a threshold; one row per logs alert.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Alert UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),+ "name": StringDatabaseField(name="name", description="Alert name."),"_enabled": BooleanDatabaseField(name="enabled", hidden=True),- "enabled": ExpressionField(name="enabled", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_enabled"])])),- "filters": StringJSONDatabaseField(name="filters"),- "threshold_count": IntegerDatabaseField(name="threshold_count"),- "threshold_operator": StringDatabaseField(name="threshold_operator"),- "window_minutes": IntegerDatabaseField(name="window_minutes"),- "check_interval_minutes": IntegerDatabaseField(name="check_interval_minutes"),- "state": StringDatabaseField(name="state"),- "evaluation_periods": IntegerDatabaseField(name="evaluation_periods"),- "datapoints_to_alarm": IntegerDatabaseField(name="datapoints_to_alarm"),- "cooldown_minutes": IntegerDatabaseField(name="cooldown_minutes"),- "snooze_until": DateTimeDatabaseField(name="snooze_until", nullable=True),- "next_check_at": DateTimeDatabaseField(name="next_check_at", nullable=True),- "last_notified_at": DateTimeDatabaseField(name="last_notified_at", nullable=True),- "last_checked_at": DateTimeDatabaseField(name="last_checked_at", nullable=True),- "consecutive_failures": IntegerDatabaseField(name="consecutive_failures"),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "enabled": ExpressionField(+ name="enabled",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_enabled"])]),+ description="1 if the alert is enabled, 0 otherwise.",+ ),+ "filters": StringJSONDatabaseField(+ name="filters", description="JSON log filters defining which logs the alert counts."+ ),+ "threshold_count": IntegerDatabaseField(+ name="threshold_count", description="Log count threshold that triggers the alert."+ ),+ "threshold_operator": StringDatabaseField(+ name="threshold_operator", description="Comparison against the threshold, e.g. '>', '>='."+ ),+ "window_minutes": IntegerDatabaseField(+ name="window_minutes", description="Length of the evaluation window, in minutes."+ ),+ "check_interval_minutes": IntegerDatabaseField(+ name="check_interval_minutes", description="How often the alert is evaluated, in minutes."+ ),+ "state": StringDatabaseField(name="state", description="Current alert state, e.g. 'firing' or 'not_firing'."),+ "evaluation_periods": IntegerDatabaseField(+ name="evaluation_periods", description="Number of consecutive periods evaluated together."+ ),+ "datapoints_to_alarm": IntegerDatabaseField(+ name="datapoints_to_alarm", description="How many periods must breach before alarming."+ ),+ "cooldown_minutes": IntegerDatabaseField(+ name="cooldown_minutes", description="Minimum minutes between notifications."+ ),+ "snooze_until": DateTimeDatabaseField(+ name="snooze_until", nullable=True, description="Alert is snoozed until this time."+ ),+ "next_check_at": DateTimeDatabaseField(+ name="next_check_at", nullable=True, description="When the alert is next scheduled to be evaluated."+ ),+ "last_notified_at": DateTimeDatabaseField(+ name="last_notified_at", nullable=True, description="When a notification was last sent."+ ),+ "last_checked_at": DateTimeDatabaseField(+ name="last_checked_at", nullable=True, description="When the alert was last evaluated."+ ),+ "consecutive_failures": IntegerDatabaseField(+ name="consecutive_failures", description="Number of consecutive evaluation failures."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the alert was created."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the alert was last updated."),},)@@ -956,34 +1480,70 @@ support_tickets: PostgresTable = PostgresTable(name="support_tickets",postgres_table_name="posthog_conversations_ticket",access_scope="ticket",+ description="Customer support tickets/conversations; one row per ticket, with channel, status, and message counts.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Ticket UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "ticket_number": IntegerDatabaseField(name="ticket_number"),- "channel_source": StringDatabaseField(name="channel_source"),- "channel_detail": StringDatabaseField(name="channel_detail", nullable=True),- "distinct_id": StringDatabaseField(name="distinct_id"),- "status": StringDatabaseField(name="status"),- "priority": StringDatabaseField(name="priority", nullable=True),- "anonymous_traits": StringJSONDatabaseField(name="anonymous_traits"),+ "ticket_number": IntegerDatabaseField(+ name="ticket_number", description="Human-friendly sequential ticket number."+ ),+ "channel_source": StringDatabaseField(+ name="channel_source", description="Channel the ticket came in on, e.g. 'email', 'widget'."+ ),+ "channel_detail": StringDatabaseField(+ name="channel_detail", nullable=True, description="Additional channel detail, e.g. inbox or address."+ ),+ "distinct_id": StringDatabaseField(+ name="distinct_id", description="Distinct id of the person who opened the ticket."+ ),+ "status": StringDatabaseField(name="status", description="Ticket status, e.g. 'open', 'pending', 'closed'."),+ "priority": StringDatabaseField(+ name="priority", nullable=True, description="Ticket priority, e.g. 'low', 'high'."+ ),+ "anonymous_traits": StringJSONDatabaseField(+ name="anonymous_traits", description="JSON traits captured for an anonymous requester."+ ),"_ai_resolved": BooleanDatabaseField(name="ai_resolved", hidden=True),"ai_resolved": ExpressionField(name="ai_resolved",expr=ast.Call(name="toInt", args=[ast.Field(chain=["_ai_resolved"])]),+ description="1 if the ticket was resolved by AI without human escalation, 0 otherwise.",+ ),+ "escalation_reason": StringDatabaseField(+ name="escalation_reason", nullable=True, description="Why the ticket was escalated to a human, if it was."+ ),+ "message_count": IntegerDatabaseField(+ name="message_count", description="Total number of messages in the ticket."+ ),+ "unread_customer_count": IntegerDatabaseField(+ name="unread_customer_count", description="Messages unread by the customer."+ ),+ "unread_team_count": IntegerDatabaseField(+ name="unread_team_count", description="Messages unread by the support team."),- "escalation_reason": StringDatabaseField(name="escalation_reason", nullable=True),- "message_count": IntegerDatabaseField(name="message_count"),- "unread_customer_count": IntegerDatabaseField(name="unread_customer_count"),- "unread_team_count": IntegerDatabaseField(name="unread_team_count"),- "last_message_at": DateTimeDatabaseField(name="last_message_at", nullable=True),- "last_message_text": StringDatabaseField(name="last_message_text", nullable=True),- "email_subject": StringDatabaseField(name="email_subject", nullable=True),- "email_from": StringDatabaseField(name="email_from", nullable=True),- "session_id": StringDatabaseField(name="session_id", nullable=True),- "session_context": StringJSONDatabaseField(name="session_context"),- "sla_due_at": DateTimeDatabaseField(name="sla_due_at", nullable=True),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "last_message_at": DateTimeDatabaseField(+ name="last_message_at", nullable=True, description="When the most recent message was sent."+ ),+ "last_message_text": StringDatabaseField(+ name="last_message_text", nullable=True, description="Text of the most recent message."+ ),+ "email_subject": StringDatabaseField(+ name="email_subject", nullable=True, description="Subject line for email-channel tickets."+ ),+ "email_from": StringDatabaseField(+ name="email_from", nullable=True, description="Sender address for email-channel tickets."+ ),+ "session_id": StringDatabaseField(+ name="session_id", nullable=True, description="Session recording id associated with the ticket, if any."+ ),+ "session_context": StringJSONDatabaseField(+ name="session_context", description="JSON context captured from the user's session."+ ),+ "sla_due_at": DateTimeDatabaseField(+ name="sla_due_at", nullable=True, description="When the ticket's SLA response is due."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the ticket was opened."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the ticket was last updated."),},)@@ -991,16 +1551,27 @@ review_queues: PostgresTable = PostgresTable(name="review_queues",postgres_table_name="llm_analytics_reviewqueue",access_scope="llm_analytics",+ description="AI observability review queues: named lists of traces queued for human review; one row per queue.",fields={- "id": UUIDDatabaseField(name="id"),+ "id": UUIDDatabaseField(name="id", description="Queue UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),- "created_by_id": IntegerDatabaseField(name="created_by_id", nullable=True),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at", nullable=True),+ "name": StringDatabaseField(name="name", description="Queue name."),+ "created_by_id": IntegerDatabaseField(+ name="created_by_id", nullable=True, description="User who created the queue."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the queue was created."),+ "updated_at": DateTimeDatabaseField(+ name="updated_at", nullable=True, description="When the queue was last updated."+ ),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),- "deleted_at": DateTimeDatabaseField(name="deleted_at", nullable=True),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the queue has been deleted, 0 otherwise.",+ ),+ "deleted_at": DateTimeDatabaseField(+ name="deleted_at", nullable=True, description="When the queue was deleted; NULL if not deleted."+ ),},)@@ -1008,17 +1579,30 @@ review_queue_items: PostgresTable = PostgresTable(name="review_queue_items",postgres_table_name="llm_analytics_reviewqueueitem",access_scope="llm_analytics",+ description="Individual LLM traces queued in a review queue; one row per queued trace.",fields={- "id": UUIDDatabaseField(name="id"),+ "id": UUIDDatabaseField(name="id", description="Queue item UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "queue_id": UUIDDatabaseField(name="queue_id"),- "trace_id": StringDatabaseField(name="trace_id"),- "created_by_id": IntegerDatabaseField(name="created_by_id", nullable=True),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at", nullable=True),+ "queue_id": UUIDDatabaseField(+ name="queue_id", description="Queue this item belongs to; joins to review_queues.id."+ ),+ "trace_id": StringDatabaseField(name="trace_id", description="LLM trace queued for review."),+ "created_by_id": IntegerDatabaseField(+ name="created_by_id", nullable=True, description="User who added the item to the queue."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the item was queued."),+ "updated_at": DateTimeDatabaseField(+ name="updated_at", nullable=True, description="When the item was last updated."+ ),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),- "deleted_at": DateTimeDatabaseField(name="deleted_at", nullable=True),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the item has been deleted, 0 otherwise.",+ ),+ "deleted_at": DateTimeDatabaseField(+ name="deleted_at", nullable=True, description="When the item was deleted; NULL if not deleted."+ ),},)@@ -1026,18 +1610,31 @@ trace_reviews: PostgresTable = PostgresTable(name="trace_reviews",postgres_table_name="llm_analytics_tracereview",access_scope="llm_analytics",+ description="Human reviews of LLM traces; one row per review, with scores attached in trace_review_scores.",fields={- "id": UUIDDatabaseField(name="id"),+ "id": UUIDDatabaseField(name="id", description="Review UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "trace_id": StringDatabaseField(name="trace_id"),- "created_by_id": IntegerDatabaseField(name="created_by_id", nullable=True),- "reviewed_by_id": IntegerDatabaseField(name="reviewed_by_id", nullable=True),- "comment": StringDatabaseField(name="comment", nullable=True),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at", nullable=True),+ "trace_id": StringDatabaseField(name="trace_id", description="LLM trace that was reviewed."),+ "created_by_id": IntegerDatabaseField(+ name="created_by_id", nullable=True, description="User who created the review record."+ ),+ "reviewed_by_id": IntegerDatabaseField(+ name="reviewed_by_id", nullable=True, description="User who performed the review."+ ),+ "comment": StringDatabaseField(name="comment", nullable=True, description="Reviewer's free-text comment."),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the review was created."),+ "updated_at": DateTimeDatabaseField(+ name="updated_at", nullable=True, description="When the review was last updated."+ ),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),- "deleted_at": DateTimeDatabaseField(name="deleted_at", nullable=True),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the review has been deleted, 0 otherwise.",+ ),+ "deleted_at": DateTimeDatabaseField(+ name="deleted_at", nullable=True, description="When the review was deleted; NULL if not deleted."+ ),},)@@ -1047,20 +1644,43 @@ trace_review_scores: PostgresTable = PostgresTable(access_scope="llm_analytics",# Child of trace_review: object-level access control applies to the parent review, not the score's own id.access_control_id_field="review_id",+ description="Scores recorded against a trace review for a given score definition; one row per (review, score) pair.",fields={- "id": UUIDDatabaseField(name="id"),+ "id": UUIDDatabaseField(name="id", description="Score UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "review_id": UUIDDatabaseField(name="review_id"),- "definition_id": UUIDDatabaseField(name="definition_id"),- "definition_version": UUIDDatabaseField(name="definition_version"),- "definition_version_number": IntegerDatabaseField(name="definition_version_number"),- "definition_config": StringJSONDatabaseField(name="definition_config"),- "categorical_values": StringArrayDatabaseField(name="categorical_values", nullable=True),- "numeric_value": DecimalDatabaseField(name="numeric_value", nullable=True),- "boolean_value": BooleanDatabaseField(name="boolean_value", nullable=True),- "created_by_id": IntegerDatabaseField(name="created_by_id", nullable=True),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at", nullable=True),+ "review_id": UUIDDatabaseField(+ name="review_id", description="Review this score belongs to; joins to trace_reviews.id."+ ),+ "definition_id": UUIDDatabaseField(+ name="definition_id", description="Score definition scored against; joins to score_definitions.id."+ ),+ "definition_version": UUIDDatabaseField(+ name="definition_version", description="Specific version of the score definition used."+ ),+ "definition_version_number": IntegerDatabaseField(+ name="definition_version_number", description="Numeric version of the score definition used."+ ),+ "definition_config": StringJSONDatabaseField(+ name="definition_config", description="JSON snapshot of the definition config at scoring time."+ ),+ "categorical_values": StringArrayDatabaseField(+ name="categorical_values",+ nullable=True,+ description="Selected category values, for categorical score kinds.",+ ),+ "numeric_value": DecimalDatabaseField(+ name="numeric_value", nullable=True, description="Recorded value, for numeric score kinds."+ ),+ "boolean_value": BooleanDatabaseField(+ name="boolean_value", nullable=True, description="Recorded value, for boolean score kinds."+ ),+ "created_by_id": IntegerDatabaseField(+ name="created_by_id", nullable=True, description="User who recorded the score."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the score was recorded."),+ "updated_at": DateTimeDatabaseField(+ name="updated_at", nullable=True, description="When the score was last updated."+ ),},)@@ -1068,17 +1688,26 @@ score_definitions: PostgresTable = PostgresTable(name="score_definitions",postgres_table_name="llm_analytics_scoredefinition",access_scope="llm_analytics",+ description="Definitions of scores/metrics used when reviewing LLM traces; one row per score definition.",fields={- "id": UUIDDatabaseField(name="id"),+ "id": UUIDDatabaseField(name="id", description="Score definition UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),- "description": StringDatabaseField(name="description"),- "kind": StringDatabaseField(name="kind"),- "archived": BooleanDatabaseField(name="archived"),- "current_version_id": UUIDDatabaseField(name="current_version_id", nullable=True),- "created_by_id": IntegerDatabaseField(name="created_by_id", nullable=True),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at", nullable=True),+ "name": StringDatabaseField(name="name", description="Score definition name."),+ "description": StringDatabaseField(name="description", description="What the score measures."),+ "kind": StringDatabaseField(+ name="kind", description="Score value type, e.g. 'categorical', 'numeric', 'boolean'."+ ),+ "archived": BooleanDatabaseField(name="archived", description="Whether the definition is archived."),+ "current_version_id": UUIDDatabaseField(+ name="current_version_id", nullable=True, description="Currently active version of this definition."+ ),+ "created_by_id": IntegerDatabaseField(+ name="created_by_id", nullable=True, description="User who created the definition."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the definition was created."),+ "updated_at": DateTimeDatabaseField(+ name="updated_at", nullable=True, description="When the definition was last updated."+ ),},)@@ -1086,15 +1715,22 @@ early_access_features: PostgresTable = PostgresTable(name="early_access_features",postgres_table_name="posthog_earlyaccessfeature",access_scope="early_access_feature",+ description="Early access features users can opt into; one row per feature, backed by a feature flag.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Early access feature UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "feature_flag_id": IntegerDatabaseField(name="feature_flag_id"),- "name": StringDatabaseField(name="name"),- "description": StringDatabaseField(name="description"),- "stage": StringDatabaseField(name="stage"),- "documentation_url": StringDatabaseField(name="documentation_url"),- "created_at": DateTimeDatabaseField(name="created_at"),+ "feature_flag_id": IntegerDatabaseField(+ name="feature_flag_id", description="Feature flag gating the feature; joins to feature_flags.id."+ ),+ "name": StringDatabaseField(name="name", description="Feature name shown to users."),+ "description": StringDatabaseField(name="description", description="Feature description shown to users."),+ "stage": StringDatabaseField(+ name="stage", description="Lifecycle stage, e.g. 'concept', 'beta', 'general-availability'."+ ),+ "documentation_url": StringDatabaseField(+ name="documentation_url", description="Link to the feature's documentation."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the feature was created."),},)@@ -1102,17 +1738,32 @@ usage_metrics: PostgresTable = PostgresTable(name="usage_metrics",postgres_table_name="posthog_groupusagemetric",access_scope="usage_metric",+ description="Per-group usage metric definitions shown on group dashboards; one row per metric.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Usage metric UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "group_type_index": IntegerDatabaseField(name="group_type_index"),- "name": StringDatabaseField(name="name"),- "format": StringDatabaseField(name="format"),- "interval": IntegerDatabaseField(name="interval"),- "display": StringDatabaseField(name="display"),- "filters": StringJSONDatabaseField(name="filters"),- "math": StringDatabaseField(name="math"),- "math_property": StringDatabaseField(name="math_property", nullable=True),+ "group_type_index": IntegerDatabaseField(+ name="group_type_index", description="Group type the metric applies to (0-4)."+ ),+ "name": StringDatabaseField(name="name", description="Metric name."),+ "format": StringDatabaseField(+ name="format", description="Display format, e.g. 'numeric', 'currency', 'percentage'."+ ),+ "interval": IntegerDatabaseField(+ name="interval", description="Rolling window length, in days, the metric is computed over."+ ),+ "display": StringDatabaseField(+ name="display", description="How the metric is visualized, e.g. 'number' or 'sparkline'."+ ),+ "filters": StringJSONDatabaseField(+ name="filters", description="JSON event filters defining what the metric counts."+ ),+ "math": StringDatabaseField(name="math", description="Aggregation applied, e.g. 'total', 'unique', 'sum'."),+ "math_property": StringDatabaseField(+ name="math_property",+ nullable=True,+ description="Property aggregated when math is property-based, e.g. sum.",+ ),},)@@ -1124,31 +1775,53 @@ tasks: PostgresTable = PostgresTable(# Mirror the REST API's default filter: internal tasks (signals pipeline, etc.) are not# exposed to end users. They are excluded entirely from HogQL.predicates=[parse_expr("internal != true")],+ description="Tasks (PostHog Code / agent work items); one row per user-facing task (internal pipeline tasks are excluded).",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Task UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "created_by_id": IntegerDatabaseField(name="created_by_id", nullable=True),- "github_integration_id": IntegerDatabaseField(name="github_integration_id", nullable=True),- "task_number": IntegerDatabaseField(name="task_number", nullable=True),- "title": StringDatabaseField(name="title"),+ "created_by_id": IntegerDatabaseField(+ name="created_by_id", nullable=True, description="User who created the task."+ ),+ "github_integration_id": IntegerDatabaseField(+ name="github_integration_id",+ nullable=True,+ description="GitHub integration used for the task; joins to integrations.id.",+ ),+ "task_number": IntegerDatabaseField(+ name="task_number", nullable=True, description="Human-friendly sequential task number."+ ),+ "title": StringDatabaseField(name="title", description="Task title."),"_title_manually_set": BooleanDatabaseField(name="title_manually_set", hidden=True),"title_manually_set": ExpressionField(name="title_manually_set",expr=ast.Call(name="toInt", args=[ast.Field(chain=["_title_manually_set"])]),+ description="1 if the title was set by a user rather than auto-generated, 0 otherwise.",+ ),+ "description": StringDatabaseField(name="description", description="Task description/prompt."),+ "origin_product": StringDatabaseField(name="origin_product", description="Product the task originated from."),+ "repository": StringDatabaseField(+ name="repository", nullable=True, description="Target repository, e.g. 'owner/repo'."+ ),+ "json_schema": StringJSONDatabaseField(+ name="json_schema", nullable=True, description="JSON schema describing structured task inputs/outputs."),- "description": StringDatabaseField(name="description"),- "origin_product": StringDatabaseField(name="origin_product"),- "repository": StringDatabaseField(name="repository", nullable=True),- "json_schema": StringJSONDatabaseField(name="json_schema", nullable=True),"_internal": BooleanDatabaseField(name="internal", hidden=True),"internal": ExpressionField(- name="internal", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_internal"])])+ name="internal",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_internal"])]),+ description="1 for internal pipeline tasks, 0 for user tasks (always 0 here due to the table filter).",),"_deleted": BooleanDatabaseField(name="deleted", hidden=True),- "deleted": ExpressionField(name="deleted", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])])),- "deleted_at": DateTimeDatabaseField(name="deleted_at", nullable=True),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the task has been deleted, 0 otherwise.",+ ),+ "deleted_at": DateTimeDatabaseField(+ name="deleted_at", nullable=True, description="When the task was deleted; NULL if not deleted."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the task was created."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the task was last updated."),},)@@ -1156,20 +1829,29 @@ task_runs: PostgresTable = PostgresTable(name="task_runs",postgres_table_name="posthog_task_run",access_scope="task",+ description="Execution runs of a task; one row per run attempt, with status and outputs.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Task run UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "task_id": StringDatabaseField(name="task_id"),- "branch": StringDatabaseField(name="branch", nullable=True),- "environment": StringDatabaseField(name="environment"),- "stage": StringDatabaseField(name="stage", nullable=True),- "status": StringDatabaseField(name="status"),- "error_message": StringDatabaseField(name="error_message", nullable=True),- "output": StringJSONDatabaseField(name="output", nullable=True),- "artifacts": StringJSONDatabaseField(name="artifacts"),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),- "completed_at": DateTimeDatabaseField(name="completed_at", nullable=True),+ "task_id": StringDatabaseField(name="task_id", description="Task this run belongs to; joins to tasks.id."),+ "branch": StringDatabaseField(name="branch", nullable=True, description="Git branch the run worked on."),+ "environment": StringDatabaseField(name="environment", description="Environment the run executed in."),+ "stage": StringDatabaseField(name="stage", nullable=True, description="Current workflow stage of the run."),+ "status": StringDatabaseField(name="status", description="Run status, e.g. Running, Completed, Failed."),+ "error_message": StringDatabaseField(+ name="error_message", nullable=True, description="Error message if the run failed."+ ),+ "output": StringJSONDatabaseField(+ name="output", nullable=True, description="JSON structured output produced by the run."+ ),+ "artifacts": StringJSONDatabaseField(+ name="artifacts", description="JSON references to artifacts produced (PRs, files, etc.)."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the run started."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the run row was last updated."),+ "completed_at": DateTimeDatabaseField(+ name="completed_at", nullable=True, description="When the run finished; NULL while running."+ ),},)@@ -1181,27 +1863,43 @@ sandbox_environments: PostgresTable = PostgresTable(# - private envs are only visible to their creator (no per-user context here, so excluded entirely)# - internal envs (signals pipeline, etc.) are not exposed to end userspredicates=[parse_expr("private != true"), parse_expr("internal != true")],+ description="Sandbox environments that task runs execute in (network policy, allowed repos); one row per shared environment (private and internal environments are excluded).",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Sandbox environment UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "created_by_id": IntegerDatabaseField(name="created_by_id", nullable=True),- "name": StringDatabaseField(name="name"),- "network_access_level": StringDatabaseField(name="network_access_level"),- "allowed_domains": StringArrayDatabaseField(name="allowed_domains"),+ "created_by_id": IntegerDatabaseField(+ name="created_by_id", nullable=True, description="User who created the environment."+ ),+ "name": StringDatabaseField(name="name", description="Environment name."),+ "network_access_level": StringDatabaseField(+ name="network_access_level", description="Network egress policy, e.g. 'none', 'restricted', 'full'."+ ),+ "allowed_domains": StringArrayDatabaseField(+ name="allowed_domains", description="Domains the sandbox may reach when egress is restricted."+ ),"_include_default_domains": BooleanDatabaseField(name="include_default_domains", hidden=True),"include_default_domains": ExpressionField(name="include_default_domains",expr=ast.Call(name="toInt", args=[ast.Field(chain=["_include_default_domains"])]),+ description="1 if the platform default allow-list is merged with allowed_domains, 0 otherwise.",+ ),+ "repositories": StringArrayDatabaseField(+ name="repositories", description="Repositories the environment may check out."),- "repositories": StringArrayDatabaseField(name="repositories"),"_private": BooleanDatabaseField(name="private", hidden=True),- "private": ExpressionField(name="private", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_private"])])),+ "private": ExpressionField(+ name="private",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_private"])]),+ description="1 if private to its creator, 0 if shared (always 0 here due to the table filter).",+ ),"_internal": BooleanDatabaseField(name="internal", hidden=True),"internal": ExpressionField(- name="internal", expr=ast.Call(name="toInt", args=[ast.Field(chain=["_internal"])])+ name="internal",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_internal"])]),+ description="1 for internal environments, 0 for user environments (always 0 here due to the table filter).",),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the environment was created."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the environment was last updated."),},)@@ -1209,19 +1907,28 @@ business_knowledge_sources: PostgresTable = PostgresTable(name="business_knowledge_sources",postgres_table_name="posthog_business_knowledge_knowledgesource",access_scope="business_knowledge",+ description="Sources of business knowledge ingested for AI context (uploaded files, crawled URLs); one row per source.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Source UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),- "source_type": StringDatabaseField(name="source_type"),- "status": StringDatabaseField(name="status"),- "error_message": StringDatabaseField(name="error_message"),- "source_url": StringDatabaseField(name="source_url"),- "crawl_mode": StringDatabaseField(name="crawl_mode"),- "original_filename": StringDatabaseField(name="original_filename"),- "file_content_type": StringDatabaseField(name="file_content_type"),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "name": StringDatabaseField(name="name", description="Source name."),+ "source_type": StringDatabaseField(name="source_type", description="Source type, e.g. 'file' or 'url'."),+ "status": StringDatabaseField(+ name="status", description="Ingestion status, e.g. 'pending', 'processing', 'completed', 'failed'."+ ),+ "error_message": StringDatabaseField(name="error_message", description="Error message if ingestion failed."),+ "source_url": StringDatabaseField(name="source_url", description="URL crawled, for url-type sources."),+ "crawl_mode": StringDatabaseField(+ name="crawl_mode", description="Crawl strategy for url sources, e.g. single page vs site."+ ),+ "original_filename": StringDatabaseField(+ name="original_filename", description="Uploaded file name, for file-type sources."+ ),+ "file_content_type": StringDatabaseField(+ name="file_content_type", description="MIME type of the uploaded file."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the source was added."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the source was last updated."),},)@@ -1229,17 +1936,28 @@ business_knowledge_documents: PostgresTable = PostgresTable(name="business_knowledge_documents",postgres_table_name="posthog_business_knowledge_knowledgedocument",access_scope="business_knowledge",+ description="Documents extracted from a business knowledge source (e.g. one page or file); one row per document.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Document UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "source_id": StringDatabaseField(name="source_id"),- "stable_id": StringDatabaseField(name="stable_id"),- "title": StringDatabaseField(name="title"),- "url": StringDatabaseField(name="url"),- "content_hash": StringDatabaseField(name="content_hash"),- "tombstoned_at": DateTimeDatabaseField(name="tombstoned_at", nullable=True),- "created_at": DateTimeDatabaseField(name="created_at"),- "updated_at": DateTimeDatabaseField(name="updated_at"),+ "source_id": StringDatabaseField(+ name="source_id", description="Source the document came from; joins to business_knowledge_sources.id."+ ),+ "stable_id": StringDatabaseField(+ name="stable_id", description="Stable identifier that survives re-ingestion of the same document."+ ),+ "title": StringDatabaseField(name="title", description="Document title."),+ "url": StringDatabaseField(name="url", description="URL the document was fetched from, if any."),+ "content_hash": StringDatabaseField(+ name="content_hash", description="Hash of the document content, used to detect changes."+ ),+ "tombstoned_at": DateTimeDatabaseField(+ name="tombstoned_at",+ nullable=True,+ description="When the document was tombstoned (removed from source); NULL if live.",+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the document was first ingested."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the document was last updated."),},)@@ -1247,16 +1965,25 @@ business_knowledge_chunks: PostgresTable = PostgresTable(name="business_knowledge_chunks",postgres_table_name="posthog_business_knowledge_knowledgechunk",access_scope="business_knowledge",+ description="Chunks a knowledge document is split into for embedding/retrieval; one row per chunk.",fields={- "id": StringDatabaseField(name="id"),+ "id": StringDatabaseField(name="id", description="Chunk UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "source_id": StringDatabaseField(name="source_id"),- "document_id": StringDatabaseField(name="document_id"),- "heading_path": StringDatabaseField(name="heading_path"),- "ordinal": IntegerDatabaseField(name="ordinal"),- "content": StringDatabaseField(name="content"),- "char_count": IntegerDatabaseField(name="char_count"),- "created_at": DateTimeDatabaseField(name="created_at"),+ "source_id": StringDatabaseField(+ name="source_id", description="Source the chunk belongs to; joins to business_knowledge_sources.id."+ ),+ "document_id": StringDatabaseField(+ name="document_id", description="Document the chunk belongs to; joins to business_knowledge_documents.id."+ ),+ "heading_path": StringDatabaseField(+ name="heading_path", description="Breadcrumb of headings locating the chunk within the document."+ ),+ "ordinal": IntegerDatabaseField(+ name="ordinal", description="0-based position of the chunk within its document."+ ),+ "content": StringDatabaseField(name="content", description="Text content of the chunk."),+ "char_count": IntegerDatabaseField(name="char_count", description="Number of characters in the chunk."),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the chunk was created."),},)@@ -1264,10 +1991,11 @@ business_knowledge_chunks: PostgresTable = PostgresTable(tags: PostgresTable = PostgresTable(name="tags",postgres_table_name="posthog_tag",+ description="Tags that can be attached to taggable objects (insights, dashboards, etc.); one row per tag.",fields={- "id": UUIDDatabaseField(name="id"),+ "id": UUIDDatabaseField(name="id", description="Tag UUID."),"team_id": IntegerDatabaseField(name="team_id"),- "name": StringDatabaseField(name="name"),+ "name": StringDatabaseField(name="name", description="Tag text."),},)diff --git a/posthog/hogql/database/schema/web_analytics_preaggregated.py b/posthog/hogql/database/schema/web_analytics_preaggregated.pyindex 7fa44a0c9345..6a8635e42dba 100644--- a/posthog/hogql/database/schema/web_analytics_preaggregated.py+++ b/posthog/hogql/database/schema/web_analytics_preaggregated.py@@ -9,37 +9,71 @@ from posthog.hogql.database.models import ()DEVICE_BROWSER_FIELDS = {- "browser": StringDatabaseField(name="browser", nullable=True),- "os": StringDatabaseField(name="os", nullable=True),- "viewport_width": IntegerDatabaseField(name="viewport_width", nullable=True),- "viewport_height": IntegerDatabaseField(name="viewport_height", nullable=True),+ "browser": StringDatabaseField(name="browser", nullable=True, description="Browser name of the session's device."),+ "os": StringDatabaseField(name="os", nullable=True, description="Operating system name of the session's device."),+ "viewport_width": IntegerDatabaseField(+ name="viewport_width", nullable=True, description="Browser viewport width in CSS pixels."+ ),+ "viewport_height": IntegerDatabaseField(+ name="viewport_height", nullable=True, description="Browser viewport height in CSS pixels."+ ),}GEOIP_FIELDS = {- "country_code": StringDatabaseField(name="country_code", nullable=True),- "city_name": StringDatabaseField(name="city_name", nullable=True),- "region_code": StringDatabaseField(name="region_code", nullable=True),- "region_name": StringDatabaseField(name="region_name", nullable=True),+ "country_code": StringDatabaseField(+ name="country_code", nullable=True, description="GeoIP-resolved ISO country code (e.g. 'US')."+ ),+ "city_name": StringDatabaseField(name="city_name", nullable=True, description="GeoIP-resolved city name."),+ "region_code": StringDatabaseField(+ name="region_code", nullable=True, description="GeoIP-resolved region/subdivision code."+ ),+ "region_name": StringDatabaseField(name="region_name", nullable=True, description="GeoIP-resolved region name."),}UTM_FIELDS = {- "utm_source": StringDatabaseField(name="utm_source", nullable=True),- "utm_medium": StringDatabaseField(name="utm_medium", nullable=True),- "utm_campaign": StringDatabaseField(name="utm_campaign", nullable=True),- "utm_term": StringDatabaseField(name="utm_term", nullable=True),- "utm_content": StringDatabaseField(name="utm_content", nullable=True),- "referring_domain": StringDatabaseField(name="referring_domain", nullable=True),+ "utm_source": StringDatabaseField(+ name="utm_source", nullable=True, description="Session's initial utm_source attribution value."+ ),+ "utm_medium": StringDatabaseField(+ name="utm_medium", nullable=True, description="Session's initial utm_medium attribution value."+ ),+ "utm_campaign": StringDatabaseField(+ name="utm_campaign", nullable=True, description="Session's initial utm_campaign attribution value."+ ),+ "utm_term": StringDatabaseField(+ name="utm_term", nullable=True, description="Session's initial utm_term attribution value."+ ),+ "utm_content": StringDatabaseField(+ name="utm_content", nullable=True, description="Session's initial utm_content attribution value."+ ),+ "referring_domain": StringDatabaseField(+ name="referring_domain", nullable=True, description="Session's initial referring domain ('$direct' if none)."+ ),}ATTRIBUTION_FIELDS = {- "has_gclid": BooleanDatabaseField(name="has_gclid", nullable=True),- "has_gad_source_paid_search": BooleanDatabaseField(name="has_gad_source_paid_search", nullable=True),- "has_fbclid": BooleanDatabaseField(name="has_fbclid", nullable=True),+ "has_gclid": BooleanDatabaseField(+ name="has_gclid", nullable=True, description="Whether the session arrived with a Google Ads gclid parameter."+ ),+ "has_gad_source_paid_search": BooleanDatabaseField(+ name="has_gad_source_paid_search",+ nullable=True,+ description="Whether the session's gad_source indicates Google paid search.",+ ),+ "has_fbclid": BooleanDatabaseField(+ name="has_fbclid",+ nullable=True,+ description="Whether the session arrived with a Meta/Facebook fbclid parameter.",+ ),}PATH_FIELDS = {- "entry_pathname": StringDatabaseField(name="entry_pathname", nullable=True),- "end_pathname": StringDatabaseField(name="end_pathname", nullable=True),+ "entry_pathname": StringDatabaseField(+ name="entry_pathname", nullable=True, description="Pathname of the first pageview in the session."+ ),+ "end_pathname": StringDatabaseField(+ name="end_pathname", nullable=True, description="Pathname of the last pageview in the session."+ ),}SHARED_SCHEMA_FIELDS = {@@ -48,41 +82,75 @@ SHARED_SCHEMA_FIELDS = {**UTM_FIELDS,**ATTRIBUTION_FIELDS,**PATH_FIELDS,- "mat_metadata_loggedIn": BooleanDatabaseField(name="mat_metadata_loggedIn", nullable=True),- "mat_metadata_backend": StringDatabaseField(name="mat_metadata_backend", nullable=True),+ "mat_metadata_loggedIn": BooleanDatabaseField(+ name="mat_metadata_loggedIn",+ nullable=True,+ description="Materialized session metadata: whether the user was logged in.",+ ),+ "mat_metadata_backend": StringDatabaseField(+ name="mat_metadata_backend",+ nullable=True,+ description="Materialized session metadata: backend/framework identifier.",+ ),}# Web stats daily specific fieldsWEB_STATS_SPECIFIC_FIELDS = {- "pathname": StringDatabaseField(name="pathname", nullable=True),+ "pathname": StringDatabaseField(+ name="pathname", nullable=True, description="Page path this stats row is broken down by."+ ),}# Web bounces daily specific fields (session calculations: bounce and duration)WEB_BOUNCES_SPECIFIC_FIELDS = {- "bounces_count_state": DatabaseField(name="bounces_count_state"),- "total_session_duration_state": DatabaseField(name="total_session_duration_state"),- "total_session_count_state": DatabaseField(name="total_session_count_state"),+ "bounces_count_state": DatabaseField(+ name="bounces_count_state",+ description="AggregateFunction state for bounced session count; merge with sumMerge to read.",+ ),+ "total_session_duration_state": DatabaseField(+ name="total_session_duration_state",+ description="AggregateFunction state for total session duration in seconds; merge with sumMerge to read.",+ ),+ "total_session_count_state": DatabaseField(+ name="total_session_count_state",+ description="AggregateFunction state for total session count; merge with sumMerge to read.",+ ),}# Base table fields present in all tablesweb_preaggregated_base_fields = {- "period_bucket": DateTimeDatabaseField(name="period_bucket"),+ "period_bucket": DateTimeDatabaseField(+ name="period_bucket", description="Start of the time bucket (day) this pre-aggregated row covers."+ ),"team_id": IntegerDatabaseField(name="team_id"),- "host": StringDatabaseField(name="host"),- "device_type": StringDatabaseField(name="device_type"),+ "host": StringDatabaseField(name="host", description="Hostname the traffic was served from."),+ "device_type": StringDatabaseField(name="device_type", description="Device type (e.g. 'Desktop', 'Mobile')."),}web_preaggregated_base_aggregation_fields = {- "persons_uniq_state": DatabaseField(name="persons_uniq_state"),- "pageviews_count_state": DatabaseField(name="pageviews_count_state"),- "sessions_uniq_state": DatabaseField(name="sessions_uniq_state"),+ "persons_uniq_state": DatabaseField(+ name="persons_uniq_state",+ description="AggregateFunction(uniq) state for unique persons; merge with uniqMerge to read.",+ ),+ "pageviews_count_state": DatabaseField(+ name="pageviews_count_state",+ description="AggregateFunction(sum) state for pageview count; merge with sumMerge to read.",+ ),+ "sessions_uniq_state": DatabaseField(+ name="sessions_uniq_state",+ description="AggregateFunction(uniq) state for unique sessions; merge with uniqMerge to read.",+ ),}class WebPreAggregatedStatsTable(Table):+ description: str = (+ "Pre-aggregated daily web analytics stats bucketed by dimensions (path, device, geo, UTM, etc.), "+ "used internally by the web analytics product. Metric columns are AggregateFunction states that must be merged."+ )fields: dict[str, FieldOrTable] = {**web_preaggregated_base_fields,**web_preaggregated_base_aggregation_fields,@@ -98,6 +166,10 @@ class WebPreAggregatedStatsTable(Table):class WebPreAggregatedBouncesTable(Table):+ description: str = (+ "Pre-aggregated daily web analytics session metrics (bounce rate and session duration) bucketed by dimensions, "+ "used internally by the web analytics product. Metric columns are AggregateFunction states that must be merged."+ )fields: dict[str, FieldOrTable] = {**web_preaggregated_base_fields,**web_preaggregated_base_aggregation_fields,diff --git a/posthog/hogql/database/schema/web_goals_preaggregated.py b/posthog/hogql/database/schema/web_goals_preaggregated.pyindex 237b5f879a01..7b46d99ebb6d 100644--- a/posthog/hogql/database/schema/web_goals_preaggregated.py+++ b/posthog/hogql/database/schema/web_goals_preaggregated.py@@ -14,6 +14,10 @@ from posthog.clickhouse.preaggregation.web_goals_preaggregated_sql import DISTRIclass WebGoalsPreaggregatedTable(Table):+ description: str = (+ "Pre-aggregated web analytics goal/action conversion metrics, broken down by action, computed per precompute "+ "job and used internally by the web analytics product. Metric columns are AggregateFunction states that must be merged."+ )# Mirrors `WebStatsPathsPreaggregatedTable`: deterministic replica# selection via `load_balancing="in_order"` (read-your-writes) and shard# pruning via `optimize_skip_unused_shards=1` (sharded by@@ -24,11 +28,22 @@ class WebGoalsPreaggregatedTable(Table):fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id"),- "job_id": StringDatabaseField(name="job_id"),- "time_window_start": DateTimeDatabaseField(name="time_window_start"),- "action_id": IntegerDatabaseField(name="action_id"),- "count_state": UnknownDatabaseField(name="count_state"),- "unique_persons_state": UnknownDatabaseField(name="unique_persons_state"),+ "job_id": StringDatabaseField(+ name="job_id", description="Identifier of the precompute job that produced this row; reads filter by it."+ ),+ "time_window_start": DateTimeDatabaseField(+ name="time_window_start", description="Start of the time window this aggregated row covers."+ ),+ "action_id": IntegerDatabaseField(+ name="action_id", description="Action this goal row aggregates; references posthog_action.id."+ ),+ "count_state": UnknownDatabaseField(+ name="count_state", description="AggregateFunction(sum) state for goal conversion count; merge to read."+ ),+ "unique_persons_state": UnknownDatabaseField(+ name="unique_persons_state",+ description="AggregateFunction(uniq) state for unique converting persons; merge to read.",+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/web_overview_preaggregated.py b/posthog/hogql/database/schema/web_overview_preaggregated.pyindex e2f0b46fe637..dd5ac509c035 100644--- a/posthog/hogql/database/schema/web_overview_preaggregated.py+++ b/posthog/hogql/database/schema/web_overview_preaggregated.py@@ -16,6 +16,11 @@ from posthog.clickhouse.preaggregation.web_overview_preaggregated_sql import (class WebOverviewPreaggregatedTable(Table):+ description: str = (+ "Pre-aggregated web analytics overview metrics (unique users/sessions, pageviews, session duration, bounce rate) "+ "computed per precompute job, used internally by the web analytics product. Metric columns are "+ "AggregateFunction states that must be merged."+ )# `load_balancing="in_order"` matches sibling lazy-precompute tables and is# important for read-your-writes: both INSERT (via _get_insert_settings) and# SELECT deterministically prefer the same replica, so the read sees data the@@ -28,16 +33,31 @@ class WebOverviewPreaggregatedTable(Table):fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id"),- "job_id": StringDatabaseField(name="job_id"),- "time_window_start": DateTimeDatabaseField(name="time_window_start"),+ "job_id": StringDatabaseField(+ name="job_id", description="Identifier of the precompute job that produced this row; reads filter by it."+ ),+ "time_window_start": DateTimeDatabaseField(+ name="time_window_start", description="Start of the time window this aggregated row covers."+ ),# Aggregate-state columns are passed straight to `uniqMergeIf`/`sumMergeIf`/`avgMergeIf`# in the read query. HogQL doesn't need to know their internal shape —# `UnknownDatabaseField` is opaque enough.- "uniq_users_state": UnknownDatabaseField(name="uniq_users_state"),- "uniq_sessions_state": UnknownDatabaseField(name="uniq_sessions_state"),- "sum_pageviews_state": UnknownDatabaseField(name="sum_pageviews_state"),- "avg_duration_state": UnknownDatabaseField(name="avg_duration_state"),- "avg_bounce_state": UnknownDatabaseField(name="avg_bounce_state"),+ "uniq_users_state": UnknownDatabaseField(+ name="uniq_users_state", description="AggregateFunction(uniq) state for unique users; merge to read."+ ),+ "uniq_sessions_state": UnknownDatabaseField(+ name="uniq_sessions_state", description="AggregateFunction(uniq) state for unique sessions; merge to read."+ ),+ "sum_pageviews_state": UnknownDatabaseField(+ name="sum_pageviews_state", description="AggregateFunction(sum) state for pageview count; merge to read."+ ),+ "avg_duration_state": UnknownDatabaseField(+ name="avg_duration_state",+ description="AggregateFunction(avg) state for session duration in seconds; merge to read.",+ ),+ "avg_bounce_state": UnknownDatabaseField(+ name="avg_bounce_state", description="AggregateFunction(avg) state for bounce rate; merge to read."+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/web_stats_frustration_preaggregated.py b/posthog/hogql/database/schema/web_stats_frustration_preaggregated.pyindex e4e4d9cef878..6fe17a42963a 100644--- a/posthog/hogql/database/schema/web_stats_frustration_preaggregated.py+++ b/posthog/hogql/database/schema/web_stats_frustration_preaggregated.py@@ -16,6 +16,11 @@ from posthog.clickhouse.preaggregation.web_stats_frustration_preaggregated_sql iclass WebStatsFrustrationPreaggregatedTable(Table):+ description: str = (+ "Pre-aggregated per-path web analytics frustration signals (rage clicks, dead clicks, errors), computed per "+ "precompute job and used internally by the web analytics product. Metric columns are AggregateFunction states "+ "that must be merged."+ )# Mirrors `WebStatsPathsPreaggregatedTable`: deterministic replica selection# via `load_balancing="in_order"` (read-your-writes) and shard pruning via# `optimize_skip_unused_shards=1` (sharded by `sipHash64(job_id)`, and the@@ -26,12 +31,24 @@ class WebStatsFrustrationPreaggregatedTable(Table):fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id"),- "job_id": StringDatabaseField(name="job_id"),- "time_window_start": DateTimeDatabaseField(name="time_window_start"),- "breakdown_value": StringDatabaseField(name="breakdown_value"),- "sum_rage_clicks_state": UnknownDatabaseField(name="sum_rage_clicks_state"),- "sum_dead_clicks_state": UnknownDatabaseField(name="sum_dead_clicks_state"),- "sum_errors_state": UnknownDatabaseField(name="sum_errors_state"),+ "job_id": StringDatabaseField(+ name="job_id", description="Identifier of the precompute job that produced this row; reads filter by it."+ ),+ "time_window_start": DateTimeDatabaseField(+ name="time_window_start", description="Start of the time window this aggregated row covers."+ ),+ "breakdown_value": StringDatabaseField(name="breakdown_value", description="Page path this row aggregates."),+ "sum_rage_clicks_state": UnknownDatabaseField(+ name="sum_rage_clicks_state",+ description="AggregateFunction(sum) state for rage-click count; merge to read.",+ ),+ "sum_dead_clicks_state": UnknownDatabaseField(+ name="sum_dead_clicks_state",+ description="AggregateFunction(sum) state for dead-click count; merge to read.",+ ),+ "sum_errors_state": UnknownDatabaseField(+ name="sum_errors_state", description="AggregateFunction(sum) state for error count; merge to read."+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/web_stats_paths_preaggregated.py b/posthog/hogql/database/schema/web_stats_paths_preaggregated.pyindex 53c525b98142..eb151d209e4f 100644--- a/posthog/hogql/database/schema/web_stats_paths_preaggregated.py+++ b/posthog/hogql/database/schema/web_stats_paths_preaggregated.py@@ -16,6 +16,11 @@ from posthog.clickhouse.preaggregation.web_stats_paths_preaggregated_sql importclass WebStatsPathsPreaggregatedTable(Table):+ description: str = (+ "Pre-aggregated per-path web analytics stats (users, pageviews, bounce rate by page path), computed per "+ "precompute job and used internally by the web analytics product. Metric columns are AggregateFunction states "+ "that must be merged."+ )# Mirrors `WebOverviewPreaggregatedTable`: deterministic replica selection# via `load_balancing="in_order"` (read-your-writes) and shard pruning via# `optimize_skip_unused_shards=1` (sharded by `sipHash64(job_id)`, and the@@ -26,12 +31,22 @@ class WebStatsPathsPreaggregatedTable(Table):fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id"),- "job_id": StringDatabaseField(name="job_id"),- "time_window_start": DateTimeDatabaseField(name="time_window_start"),- "breakdown_value": StringDatabaseField(name="breakdown_value"),- "uniq_users_state": UnknownDatabaseField(name="uniq_users_state"),- "sum_pageviews_state": UnknownDatabaseField(name="sum_pageviews_state"),- "avg_bounce_state": UnknownDatabaseField(name="avg_bounce_state"),+ "job_id": StringDatabaseField(+ name="job_id", description="Identifier of the precompute job that produced this row; reads filter by it."+ ),+ "time_window_start": DateTimeDatabaseField(+ name="time_window_start", description="Start of the time window this aggregated row covers."+ ),+ "breakdown_value": StringDatabaseField(name="breakdown_value", description="Page path this row aggregates."),+ "uniq_users_state": UnknownDatabaseField(+ name="uniq_users_state", description="AggregateFunction(uniq) state for unique users; merge to read."+ ),+ "sum_pageviews_state": UnknownDatabaseField(+ name="sum_pageviews_state", description="AggregateFunction(sum) state for pageview count; merge to read."+ ),+ "avg_bounce_state": UnknownDatabaseField(+ name="avg_bounce_state", description="AggregateFunction(avg) state for bounce rate; merge to read."+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/web_stats_preaggregated.py b/posthog/hogql/database/schema/web_stats_preaggregated.pyindex 8e2e6a5f888b..cf1761349e71 100644--- a/posthog/hogql/database/schema/web_stats_preaggregated.py+++ b/posthog/hogql/database/schema/web_stats_preaggregated.py@@ -14,6 +14,11 @@ from posthog.clickhouse.preaggregation.web_stats_preaggregated_sql import DISTRIclass WebStatsPreaggregatedTable(Table):+ description: str = (+ "Pre-aggregated web analytics stats broken down by a single dimension (breakdown_by/breakdown_value), computed "+ "per precompute job and used internally by the web analytics product. Metric columns are AggregateFunction "+ "states that must be merged."+ )# Mirrors `WebOverviewPreaggregatedTable`: deterministic replica selection# via `load_balancing="in_order"` (read-your-writes) and shard pruning via# `optimize_skip_unused_shards=1` (sharded by `sipHash64(job_id)`, and the@@ -24,12 +29,25 @@ class WebStatsPreaggregatedTable(Table):fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id"),- "job_id": StringDatabaseField(name="job_id"),- "time_window_start": DateTimeDatabaseField(name="time_window_start"),- "breakdown_by": StringDatabaseField(name="breakdown_by"),- "breakdown_value": StringDatabaseField(name="breakdown_value"),- "uniq_users_state": UnknownDatabaseField(name="uniq_users_state"),- "sum_pageviews_state": UnknownDatabaseField(name="sum_pageviews_state"),+ "job_id": StringDatabaseField(+ name="job_id", description="Identifier of the precompute job that produced this row; reads filter by it."+ ),+ "time_window_start": DateTimeDatabaseField(+ name="time_window_start", description="Start of the time window this aggregated row covers."+ ),+ "breakdown_by": StringDatabaseField(+ name="breakdown_by",+ description="Name of the dimension this row is broken down by (e.g. 'Browser', 'Country').",+ ),+ "breakdown_value": StringDatabaseField(+ name="breakdown_value", description="Value of the breakdown_by dimension for this row."+ ),+ "uniq_users_state": UnknownDatabaseField(+ name="uniq_users_state", description="AggregateFunction(uniq) state for unique users; merge to read."+ ),+ "sum_pageviews_state": UnknownDatabaseField(+ name="sum_pageviews_state", description="AggregateFunction(sum) state for pageview count; merge to read."+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/database/schema/web_vitals_paths_preaggregated.py b/posthog/hogql/database/schema/web_vitals_paths_preaggregated.pyindex cec0ddea7c13..b0d37436418b 100644--- a/posthog/hogql/database/schema/web_vitals_paths_preaggregated.py+++ b/posthog/hogql/database/schema/web_vitals_paths_preaggregated.py@@ -16,6 +16,10 @@ from posthog.clickhouse.preaggregation.web_vitals_paths_preaggregated_sql importclass WebVitalsPathsPreaggregatedTable(Table):+ description: str = (+ "Pre-aggregated per-path Core Web Vitals quantiles (INP, LCP, CLS, FCP), computed per precompute job and used "+ "internally by the web analytics product. Each metric column is an AggregateFunction(quantiles) state that must be merged."+ )# Mirrors `WebStatsPreaggregatedTable` / `WebOverviewPreaggregatedTable`:# deterministic replica selection via `load_balancing="in_order"` for# read-your-writes, and shard pruning via `optimize_skip_unused_shards=1`@@ -27,15 +31,31 @@ class WebVitalsPathsPreaggregatedTable(Table):fields: dict[str, FieldOrTable] = {"team_id": IntegerDatabaseField(name="team_id"),- "job_id": StringDatabaseField(name="job_id"),- "time_window_start": DateTimeDatabaseField(name="time_window_start"),- "path": StringDatabaseField(name="path"),+ "job_id": StringDatabaseField(+ name="job_id", description="Identifier of the precompute job that produced this row; reads filter by it."+ ),+ "time_window_start": DateTimeDatabaseField(+ name="time_window_start", description="Start of the time window this aggregated row covers."+ ),+ "path": StringDatabaseField(name="path", description="Page path these web vitals quantiles aggregate."),# One AggregateFunction(quantiles(0.75,0.9,0.99), Float64) column per# metric; the read picks the column for the queried metric.- "inp_quantiles_state": UnknownDatabaseField(name="inp_quantiles_state"),- "lcp_quantiles_state": UnknownDatabaseField(name="lcp_quantiles_state"),- "cls_quantiles_state": UnknownDatabaseField(name="cls_quantiles_state"),- "fcp_quantiles_state": UnknownDatabaseField(name="fcp_quantiles_state"),+ "inp_quantiles_state": UnknownDatabaseField(+ name="inp_quantiles_state",+ description="AggregateFunction(quantiles) state for INP (Interaction to Next Paint), in ms; merge to read.",+ ),+ "lcp_quantiles_state": UnknownDatabaseField(+ name="lcp_quantiles_state",+ description="AggregateFunction(quantiles) state for LCP (Largest Contentful Paint), in ms; merge to read.",+ ),+ "cls_quantiles_state": UnknownDatabaseField(+ name="cls_quantiles_state",+ description="AggregateFunction(quantiles) state for CLS (Cumulative Layout Shift), unitless; merge to read.",+ ),+ "fcp_quantiles_state": UnknownDatabaseField(+ name="fcp_quantiles_state",+ description="AggregateFunction(quantiles) state for FCP (First Contentful Paint), in ms; merge to read.",+ ),}def to_printed_clickhouse(self, context):diff --git a/posthog/hogql/test/__snapshots__/test_resolver.ambr b/posthog/hogql/test/__snapshots__/test_resolver.ambrindex 3cd6f0f2d7f2..f20cd9203551 100644--- a/posthog/hogql/test/__snapshots__/test_resolver.ambr+++ b/posthog/hogql/test/__snapshots__/test_resolver.ambr@@ -385,42 +385,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -457,42 +457,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -529,42 +529,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -601,42 +601,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -697,42 +697,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -769,42 +769,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -841,42 +841,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -1678,10 +1678,10 @@],hidden: False,join_table: {- description: None,+ description: "Records distinct IDs whose person mapping was corrected after ingestion (e.g. identify or person merges). One row per overridden distinct_id; used to remap events to the right person at query time.",fields: {distinct_id: {- description: None,+ description: "Distinct_id whose person mapping was overridden (e.g. after an identify or merge).",hidden: False},person: {@@ -1689,7 +1689,7 @@hidden: False},person_id: {- description: None,+ description: "Corrected person this distinct_id now resolves to; matches `persons.id`.",hidden: False},team_id: {@@ -1764,10 +1764,10 @@],hidden: False,join_table: {- description: None,+ description: "Records distinct IDs whose person mapping was corrected after ingestion (e.g. identify or person merges). One row per overridden distinct_id; used to remap events to the right person at query time.",fields: {distinct_id: {- description: None,+ description: "Distinct_id whose person mapping was overridden (e.g. after an identify or merge).",hidden: False},person: {@@ -1775,7 +1775,7 @@hidden: False},person_id: {- description: None,+ description: "Corrected person this distinct_id now resolves to; matches `persons.id`.",hidden: False},team_id: {@@ -2030,14 +2030,14 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated mapping of exception fingerprints to the issue they were reassigned to, overriding default grouping. One row per fingerprint.",fields: {fingerprint: {- description: None,+ description: "Exception fingerprint; matches `events.properties.$exception_fingerprint`.",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint maps to.",hidden: False},team_id: {@@ -2112,14 +2112,14 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated mapping of exception fingerprints to the issue they were reassigned to, overriding default grouping. One row per fingerprint.",fields: {fingerprint: {- description: None,+ description: "Exception fingerprint; matches `events.properties.$exception_fingerprint`.",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint maps to.",hidden: False},team_id: {@@ -2860,10 +2860,10 @@],hidden: False,join_table: {- description: None,+ description: "Records distinct IDs whose person mapping was corrected after ingestion (e.g. identify or person merges). One row per overridden distinct_id; used to remap events to the right person at query time.",fields: {distinct_id: {- description: None,+ description: "Distinct_id whose person mapping was overridden (e.g. after an identify or merge).",hidden: False},person: {@@ -2871,7 +2871,7 @@hidden: False},person_id: {- description: None,+ description: "Corrected person this distinct_id now resolves to; matches `persons.id`.",hidden: False},team_id: {@@ -2949,10 +2949,10 @@],hidden: False,join_table: {- description: None,+ description: "Records distinct IDs whose person mapping was corrected after ingestion (e.g. identify or person merges). One row per overridden distinct_id; used to remap events to the right person at query time.",fields: {distinct_id: {- description: None,+ description: "Distinct_id whose person mapping was overridden (e.g. after an identify or merge).",hidden: False},person: {@@ -2960,7 +2960,7 @@hidden: False},person_id: {- description: None,+ description: "Corrected person this distinct_id now resolves to; matches `persons.id`.",hidden: False},team_id: {@@ -3310,14 +3310,14 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated mapping of exception fingerprints to the issue they were reassigned to, overriding default grouping. One row per fingerprint.",fields: {fingerprint: {- description: None,+ description: "Exception fingerprint; matches `events.properties.$exception_fingerprint`.",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint maps to.",hidden: False},team_id: {@@ -3395,14 +3395,14 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated mapping of exception fingerprints to the issue they were reassigned to, overriding default grouping. One row per fingerprint.",fields: {fingerprint: {- description: None,+ description: "Exception fingerprint; matches `events.properties.$exception_fingerprint`.",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint maps to.",hidden: False},team_id: {@@ -3534,42 +3534,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -3625,42 +3625,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -3716,42 +3716,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -3807,42 +3807,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -3898,42 +3898,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -3989,42 +3989,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -4080,42 +4080,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -4223,38 +4223,38 @@alias: "e"table_type: {table: {- description: None,+ description: "Aggregated metadata for session recordings (counts, URLs, console/activity stats); one row per session. Holds metadata only, not the recording snapshots. Join to events/persons via `session_id`/`distinct_id`.",fields: {active_milliseconds: {- description: None,+ description: "Time the user was actively interacting, in milliseconds (subset of total duration).",hidden: False},ai_highlighted: {- description: None,+ description: "Whether AI flagged this recording as noteworthy (1) or not (0).",hidden: False},ai_tags_fixed: {- description: None,+ description: "AI-assigned tags from a fixed taxonomy.",hidden: False},ai_tags_freeform: {- description: None,+ description: "AI-assigned freeform tags.",hidden: False},all_urls: {- description: None,+ description: "Distinct set of URLs visited during the session.",hidden: False},click_count: {- description: None,+ description: "Total number of clicks in the session.",hidden: False},console_error_count: {- description: None,+ description: "Number of console.error messages captured.",hidden: False},console_log_count: {- description: None,+ description: "Number of console.log messages captured.",hidden: False},console_logs: {@@ -4262,19 +4262,19 @@hidden: False},console_warn_count: {- description: None,+ description: "Number of console.warn messages captured.",hidden: False},distinct_id: {- description: None,+ description: "Identifier of the user/device for the recording.",hidden: False},end_time: {- description: None,+ description: "Latest snapshot timestamp across the session (in UTC).",hidden: False},event_count: {- description: None,+ description: "Number of rrweb snapshot events in the recording.",hidden: False},events: {@@ -4282,23 +4282,23 @@hidden: False},first_url: {- description: None,+ description: "URL of the first page viewed in the session.",hidden: False},is_deleted: {- description: None,+ description: "Whether the recording has been deleted (1) or not (0).",hidden: False},keypress_count: {- description: None,+ description: "Total number of keypresses in the session.",hidden: False},message_count: {- description: None,+ description: "Number of ingestion messages that made up this recording.",hidden: False},mouse_activity_count: {- description: None,+ description: "Number of mouse activity events in the session.",hidden: False},pdi: {@@ -4318,7 +4318,7 @@hidden: False},retention_period_days: {- description: None,+ description: "Number of days the recording is retained.",hidden: False},session: {@@ -4326,27 +4326,27 @@hidden: False},session_id: {- description: None,+ description: "Recording session identifier; matches `events.$session_id` and `sessions.session_id`.",hidden: False},size: {- description: None,+ description: "Size of the recording snapshot data in bytes.",hidden: False},snapshot_library: {- description: None,+ description: "SDK/library that produced the recording snapshots.",hidden: False},snapshot_source: {- description: None,+ description: "Capture source of the recording, e.g. 'web' or 'mobile'.",hidden: False},start_time: {- description: None,+ description: "Earliest snapshot timestamp across the session (in UTC).",hidden: False},surfacing_score: {- description: None,+ description: "AI-computed score ranking how worth surfacing the recording is.",hidden: False},team_id: {@@ -5901,42 +5901,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -5973,42 +5973,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -6045,42 +6045,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -6117,42 +6117,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -6213,42 +6213,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -6285,42 +6285,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -6357,42 +6357,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -6846,42 +6846,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -6918,42 +6918,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -6990,42 +6990,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -7062,42 +7062,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -7158,42 +7158,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -7230,42 +7230,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -7302,42 +7302,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -8142,10 +8142,10 @@],hidden: False,join_table: {- description: None,+ description: "Records distinct IDs whose person mapping was corrected after ingestion (e.g. identify or person merges). One row per overridden distinct_id; used to remap events to the right person at query time.",fields: {distinct_id: {- description: None,+ description: "Distinct_id whose person mapping was overridden (e.g. after an identify or merge).",hidden: False},person: {@@ -8153,7 +8153,7 @@hidden: False},person_id: {- description: None,+ description: "Corrected person this distinct_id now resolves to; matches `persons.id`.",hidden: False},team_id: {@@ -8228,10 +8228,10 @@],hidden: False,join_table: {- description: None,+ description: "Records distinct IDs whose person mapping was corrected after ingestion (e.g. identify or person merges). One row per overridden distinct_id; used to remap events to the right person at query time.",fields: {distinct_id: {- description: None,+ description: "Distinct_id whose person mapping was overridden (e.g. after an identify or merge).",hidden: False},person: {@@ -8239,7 +8239,7 @@hidden: False},person_id: {- description: None,+ description: "Corrected person this distinct_id now resolves to; matches `persons.id`.",hidden: False},team_id: {@@ -8494,14 +8494,14 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated mapping of exception fingerprints to the issue they were reassigned to, overriding default grouping. One row per fingerprint.",fields: {fingerprint: {- description: None,+ description: "Exception fingerprint; matches `events.properties.$exception_fingerprint`.",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint maps to.",hidden: False},team_id: {@@ -8576,14 +8576,14 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated mapping of exception fingerprints to the issue they were reassigned to, overriding default grouping. One row per fingerprint.",fields: {fingerprint: {- description: None,+ description: "Exception fingerprint; matches `events.properties.$exception_fingerprint`.",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint maps to.",hidden: False},team_id: {@@ -8988,10 +8988,10 @@],hidden: False,join_table: {- description: None,+ description: "Records distinct IDs whose person mapping was corrected after ingestion (e.g. identify or person merges). One row per overridden distinct_id; used to remap events to the right person at query time.",fields: {distinct_id: {- description: None,+ description: "Distinct_id whose person mapping was overridden (e.g. after an identify or merge).",hidden: False},person: {@@ -8999,7 +8999,7 @@hidden: False},person_id: {- description: None,+ description: "Corrected person this distinct_id now resolves to; matches `persons.id`.",hidden: False},team_id: {@@ -9074,10 +9074,10 @@],hidden: False,join_table: {- description: None,+ description: "Records distinct IDs whose person mapping was corrected after ingestion (e.g. identify or person merges). One row per overridden distinct_id; used to remap events to the right person at query time.",fields: {distinct_id: {- description: None,+ description: "Distinct_id whose person mapping was overridden (e.g. after an identify or merge).",hidden: False},person: {@@ -9085,7 +9085,7 @@hidden: False},person_id: {- description: None,+ description: "Corrected person this distinct_id now resolves to; matches `persons.id`.",hidden: False},team_id: {@@ -9340,14 +9340,14 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated mapping of exception fingerprints to the issue they were reassigned to, overriding default grouping. One row per fingerprint.",fields: {fingerprint: {- description: None,+ description: "Exception fingerprint; matches `events.properties.$exception_fingerprint`.",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint maps to.",hidden: False},team_id: {@@ -9422,14 +9422,14 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated mapping of exception fingerprints to the issue they were reassigned to, overriding default grouping. One row per fingerprint.",fields: {fingerprint: {- description: None,+ description: "Exception fingerprint; matches `events.properties.$exception_fingerprint`.",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint maps to.",hidden: False},team_id: {@@ -10401,10 +10401,10 @@],hidden: False,join_table: {- description: None,+ description: "Records distinct IDs whose person mapping was corrected after ingestion (e.g. identify or person merges). One row per overridden distinct_id; used to remap events to the right person at query time.",fields: {distinct_id: {- description: None,+ description: "Distinct_id whose person mapping was overridden (e.g. after an identify or merge).",hidden: False},person: {@@ -10412,7 +10412,7 @@hidden: False},person_id: {- description: None,+ description: "Corrected person this distinct_id now resolves to; matches `persons.id`.",hidden: False},team_id: {@@ -10490,10 +10490,10 @@],hidden: False,join_table: {- description: None,+ description: "Records distinct IDs whose person mapping was corrected after ingestion (e.g. identify or person merges). One row per overridden distinct_id; used to remap events to the right person at query time.",fields: {distinct_id: {- description: None,+ description: "Distinct_id whose person mapping was overridden (e.g. after an identify or merge).",hidden: False},person: {@@ -10501,7 +10501,7 @@hidden: False},person_id: {- description: None,+ description: "Corrected person this distinct_id now resolves to; matches `persons.id`.",hidden: False},team_id: {@@ -10851,14 +10851,14 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated mapping of exception fingerprints to the issue they were reassigned to, overriding default grouping. One row per fingerprint.",fields: {fingerprint: {- description: None,+ description: "Exception fingerprint; matches `events.properties.$exception_fingerprint`.",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint maps to.",hidden: False},team_id: {@@ -10936,14 +10936,14 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated mapping of exception fingerprints to the issue they were reassigned to, overriding default grouping. One row per fingerprint.",fields: {fingerprint: {- description: None,+ description: "Exception fingerprint; matches `events.properties.$exception_fingerprint`.",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint maps to.",hidden: False},team_id: {@@ -11075,42 +11075,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -11166,42 +11166,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -11257,42 +11257,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -11348,42 +11348,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -11439,42 +11439,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -11530,42 +11530,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -11621,42 +11621,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -12196,10 +12196,10 @@],hidden: False,join_table: {- description: None,+ description: "Records distinct IDs whose person mapping was corrected after ingestion (e.g. identify or person merges). One row per overridden distinct_id; used to remap events to the right person at query time.",fields: {distinct_id: {- description: None,+ description: "Distinct_id whose person mapping was overridden (e.g. after an identify or merge).",hidden: False},person: {@@ -12207,7 +12207,7 @@hidden: False},person_id: {- description: None,+ description: "Corrected person this distinct_id now resolves to; matches `persons.id`.",hidden: False},team_id: {@@ -12285,10 +12285,10 @@],hidden: False,join_table: {- description: None,+ description: "Records distinct IDs whose person mapping was corrected after ingestion (e.g. identify or person merges). One row per overridden distinct_id; used to remap events to the right person at query time.",fields: {distinct_id: {- description: None,+ description: "Distinct_id whose person mapping was overridden (e.g. after an identify or merge).",hidden: False},person: {@@ -12296,7 +12296,7 @@hidden: False},person_id: {- description: None,+ description: "Corrected person this distinct_id now resolves to; matches `persons.id`.",hidden: False},team_id: {@@ -12646,14 +12646,14 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated mapping of exception fingerprints to the issue they were reassigned to, overriding default grouping. One row per fingerprint.",fields: {fingerprint: {- description: None,+ description: "Exception fingerprint; matches `events.properties.$exception_fingerprint`.",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint maps to.",hidden: False},team_id: {@@ -12731,14 +12731,14 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated mapping of exception fingerprints to the issue they were reassigned to, overriding default grouping. One row per fingerprint.",fields: {fingerprint: {- description: None,+ description: "Exception fingerprint; matches `events.properties.$exception_fingerprint`.",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint maps to.",hidden: False},team_id: {@@ -12870,42 +12870,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -12961,42 +12961,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -13052,42 +13052,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -13143,42 +13143,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -13234,42 +13234,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -13325,42 +13325,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -13416,42 +13416,42 @@],hidden: False,join_table: {- description: None,+ description: "Deduplicated latest issue state for each exception fingerprint; join exception events to their issue via `events.properties.$exception_fingerprint`. One row per fingerprint.",fields: {assigned_role_id: {- description: None,+ description: "Role the issue is assigned to, if any.",hidden: False},assigned_user_id: {- description: None,+ description: "User the issue is assigned to, if any.",hidden: False},fingerprint: {- description: None,+ description: "Exception fingerprint that groups matching errors; matches `events.properties.$exception_fingerprint`.",hidden: False},first_seen: {- description: None,+ description: "When the issue was first observed (in UTC).",hidden: False},fp_hash: {- description: None,+ description: "cityHash64 of the fingerprint, used as the join/group key.",hidden: False},issue_description: {- description: None,+ description: "Description of the issue (latest version).",hidden: False},issue_id: {- description: None,+ description: "Identifier of the error tracking issue this fingerprint belongs to.",hidden: False},issue_name: {- description: None,+ description: "Display name of the issue (latest version).",hidden: False},issue_status: {- description: None,+ description: "Current status of the issue, e.g. 'active', 'resolved'.",hidden: False},team_id: {@@ -16191,10 +16191,10 @@],hidden: False,join_table: {- description: None,+ description: "Maps client-side distinct IDs to resolved person IDs. One row per distinct_id; join to `persons` via the `person` field or `person_id`.",fields: {distinct_id: {- description: None,+ description: "Client-side distinct_id sent with events; multiple distinct_ids can map to one person.",hidden: False},person: {@@ -16202,7 +16202,7 @@hidden: False},person_id: {- description: None,+ description: "Resolved person this distinct_id belongs to; matches `persons.id`.",hidden: False},team_id: {@@ -16544,10 +16544,10 @@],hidden: False,join_table: {- description: None,+ description: "Maps client-side distinct IDs to resolved person IDs. One row per distinct_id; join to `persons` via the `person` field or `person_id`.",fields: {distinct_id: {- description: None,+ description: "Client-side distinct_id sent with events; multiple distinct_ids can map to one person.",hidden: False},person: {@@ -16555,7 +16555,7 @@hidden: False},person_id: {- description: None,+ description: "Resolved person this distinct_id belongs to; matches `persons.id`.",hidden: False},team_id: {@@ -16880,10 +16880,10 @@],hidden: False,join_table: {- description: None,+ description: "Maps client-side distinct IDs to resolved person IDs. One row per distinct_id; join to `persons` via the `person` field or `person_id`.",fields: {distinct_id: {- description: None,+ description: "Client-side distinct_id sent with events; multiple distinct_ids can map to one person.",hidden: False},person: {@@ -16891,7 +16891,7 @@hidden: False},person_id: {- description: None,+ description: "Resolved person this distinct_id belongs to; matches `persons.id`.",hidden: False},team_id: {@@ -17218,10 +17218,10 @@],hidden: False,join_table: {- description: None,+ description: "Maps client-side distinct IDs to resolved person IDs. One row per distinct_id; join to `persons` via the `person` field or `person_id`.",fields: {distinct_id: {- description: None,+ description: "Client-side distinct_id sent with events; multiple distinct_ids can map to one person.",hidden: False},person: {@@ -17229,7 +17229,7 @@hidden: False},person_id: {- description: None,+ description: "Resolved person this distinct_id belongs to; matches `persons.id`.",hidden: False},team_id: {@@ -17300,10 +17300,10 @@name: "distinct_id"table_type: {table: {- description: None,+ description: "Maps client-side distinct IDs to resolved person IDs. One row per distinct_id; join to `persons` via the `person` field or `person_id`.",fields: {distinct_id: {- description: None,+ description: "Client-side distinct_id sent with events; multiple distinct_ids can map to one person.",hidden: False},person: {@@ -17311,7 +17311,7 @@hidden: False},person_id: {- description: None,+ description: "Resolved person this distinct_id belongs to; matches `persons.id`.",hidden: False},team_id: {diff --git a/posthog/hogql/test/test_resolver.py b/posthog/hogql/test/test_resolver.pyindex 25fd6eae1aaa..14d4b131fca9 100644--- a/posthog/hogql/test/test_resolver.py+++ b/posthog/hogql/test/test_resolver.py@@ -1129,7 +1129,10 @@ class TestResolver(BaseTest):description="Event name, e.g. '$pageview' or 'purchase'. Autocapture/PostHog events are prefixed with '$'.",)assert cast(ast.FieldType, node.select[1].type).resolve_database_field(self.context) == StringDatabaseField(- name="person_id", array=None, nullable=False+ name="person_id",+ array=None,+ nullable=False,+ description="Resolved person this distinct_id belongs to; matches `persons.id`.",)assert cast(ast.FieldType, node.select[2].type).resolve_database_field(self.context) == StringJSONDatabaseField(name="person_properties", nullable=False