: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
chore(hogql): fix stale print_ast references in docs and comment (#61813)
posthog[bot]89ecfbcea562
diff --git a/frontend/src/scenes/web-analytics/docs/hogql_queries.md b/frontend/src/scenes/web-analytics/docs/hogql_queries.mdindex 5380bdf7347f..7ad26bd303e9 100644--- a/frontend/src/scenes/web-analytics/docs/hogql_queries.md+++ b/frontend/src/scenes/web-analytics/docs/hogql_queries.md@@ -440,7 +440,7 @@ WHERE or(equals(event, '$pageview'), equals(event, '$screen'))To print the HogQL syntax in tests instead of ClickHouse SQL:```python-from posthog.hogql.printer import print_ast+from posthog.hogql.printer import prepare_and_print_astfrom posthog.hogql.context import HogQLContext# In your test@@ -451,7 +451,8 @@ context = HogQLContext(team_id=team.pk,enable_select_queries=True,)-hogql = print_ast(query_ast, context=context, dialect="hogql")+# prepare_and_print_ast returns a (sql, prepared_ast) tuple+hogql, _ = prepare_and_print_ast(query_ast, context=context, dialect="hogql")print(hogql)```diff --git a/posthog/hogql/printer/base.py b/posthog/hogql/printer/base.pyindex a3a78be90e16..d799dc594846 100644--- a/posthog/hogql/printer/base.py+++ b/posthog/hogql/printer/base.py@@ -56,7 +56,7 @@ def resolve_field_type(expr: ast.Expr) -> ast.Type | None:class BasePrinter(Visitor[str]):- # NOTE: Call "print_ast()", not this class directly.+ # NOTE: Call "prepare_and_print_ast()", not this class directly.# Shared AST walker for all dialect printers (HogQL, ClickHouse, Postgres).# Each subclass sets ``DIALECT_NAME`` to identify itself for error messages and# resolver wiring; dialect-specific rendering lives in subclass-overridden hooks.