: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
fix(hogql): date-bound the events query examples we ship (#72311)
Paul D'Ambraafe8bde6ddb3
diff --git a/frontend/src/lib/components/MarkdownNotebook/InsertMenu.tsx b/frontend/src/lib/components/MarkdownNotebook/InsertMenu.tsxindex 47d5993888e3..59502fefb149 100644--- a/frontend/src/lib/components/MarkdownNotebook/InsertMenu.tsx+++ b/frontend/src/lib/components/MarkdownNotebook/InsertMenu.tsx@@ -399,7 +399,10 @@ export function buildInsertCommands(insertComponent(targetNodeId, 'Query', {query: {kind: 'DataTableNode',- source: { kind: 'HogQLQuery', query: 'select event, count() from events group by event' },+ source: {+ kind: 'HogQLQuery',+ query: 'select event, count() from events where timestamp >= now() - interval 7 day group by event',+ },},}),},diff --git a/products/data_warehouse/backend/presentation/views/saved_query.py b/products/data_warehouse/backend/presentation/views/saved_query.pyindex 1e0a2f5e6484..c840cb324181 100644--- a/products/data_warehouse/backend/presentation/views/saved_query.py+++ b/products/data_warehouse/backend/presentation/views/saved_query.py@@ -685,7 +685,7 @@ class DataWarehouseSavedQuerySerializer(detail=('Query must be a JSON object with a "query" key, 'f"got {type(query).__name__}. "- 'Example: {"kind": "HogQLQuery", "query": "SELECT * FROM events LIMIT 100"}'+ 'Example: {"kind": "HogQLQuery", "query": "SELECT * FROM events WHERE timestamp >= now() - INTERVAL 7 DAY LIMIT 100"}'))if not isinstance(query.get("query"), str) or not query["query"].strip():