feat(BI): postgres hogql
Problem
No problems, only solutions
Changes
- Refactor the HogQL printer, (mostly) split out the HogQL and ClickHouse parts
- Adds a WIP postgres connector to HogQL
- Adds YOLO support for connecting to the app's postgres when adding
--pgto the beginning or end of the query - All of these work:
--pg
-- SELECT version();
-- SELECT regexp_replace('bananas are amazing', 'a(.)', '[$1]', 'g')
-- SELECT jsonb_pretty(
-- jsonb_build_object(
-- 'name', 'ChatGPT',
-- 'skills', jsonb_build_array('SQL', 'Postgres', 'Dad jokes'),
-- 'nested', jsonb_build_object('x', 1, 'y', 2)
-- )
-- );
select u.email, t.name, version()
from postgres.posthog_user u
left join posthog_team t on t.id = u.current_team_id
How did you test this code?
Clicked on things
Wiz Scan Summary
| Scanner | Findings |
|---|---|
| - | |
| 1 |
|
| - | |
| - | |
| - | |
| - | |
| Total | 1 |
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.
Size Change: +1.01 kB (+0.03%)
Total Size: 3.7 MB
| Filename | Size | Change |
|---|---|---|
frontend/dist/toolbar.js |
3.7 MB | +1.01 kB (+0.03%) |
Visual regression: Storybook UI snapshots updated
Changes: 24 snapshots (24 modified, 0 added, 0 deleted)
What this means:
- Snapshots have been automatically updated to match current rendering
- Next CI run will switch to CHECK mode to verify stability
- If snapshots change again, CHECK mode will fail (indicates flapping)
Next steps:
- Review the changes to ensure they're intentional
- Approve if changes match your expectations
- If unexpected, investigate component rendering
Migration SQL Changes
Hey đź‘‹, we've detected some migrations on this PR. Here's the SQL output for each migration, make sure they make sense:
products/data_warehouse/backend/migrations/0012_add_is_direct_query.py
BEGIN;
--
-- Add field is_direct_query to externaldatasource
--
ALTER TABLE "posthog_externaldatasource" ADD COLUMN "is_direct_query" boolean DEFAULT false NOT NULL;
ALTER TABLE "posthog_externaldatasource" ALTER COLUMN "is_direct_query" DROP DEFAULT;
COMMIT;
Last updated: 2025-12-12 01:38 UTC (8f7ac84)
🔍 Migration Risk Analysis
We've analyzed your migrations for potential risks.
Summary: 1 Safe | 0 Needs Review | 0 Blocked
âś… Safe
Brief or no lock, backwards compatible
data_warehouse.0012_add_is_direct_query
└─ #1 ✅ AddField
Adding NOT NULL field with constant default (safe in PG11+)
model: externaldatasource, field: is_direct_query
Last updated: 2025-12-12 01:38 UTC (8f7ac84)
âŹď¸Ź Skipped snapshot commit because branch advanced to 66ba877 while workflow was testing 52fea87.
The new commit will trigger its own snapshot update workflow.
If you expected this workflow to succeed: This can happen due to concurrent commits. To get a fresh workflow run, either:
- Merge master into your branch, or
- Push an empty commit:
git commit --allow-empty -m 'trigger CI' && git push
Query snapshots: Backend query snapshots updated
Changes: 3 snapshots (3 modified, 0 added, 0 deleted)
What this means:
- Query snapshots have been automatically updated to match current output
- These changes reflect modifications to database queries or schema
Next steps:
- Review the query changes to ensure they're intentional
- If unexpected, investigate what caused the query to change
âŹď¸Ź Skipped snapshot commit because branch advanced to 6688a64 while workflow was testing 6f54455.
The new commit will trigger its own snapshot update workflow.
If you expected this workflow to succeed: This can happen due to concurrent commits. To get a fresh workflow run, either:
- Merge master into your branch, or
- Push an empty commit:
git commit --allow-empty -m 'trigger CI' && git push
Query snapshots: Backend query snapshots updated
Changes: 2 snapshots (2 modified, 0 added, 0 deleted)
What this means:
- Query snapshots have been automatically updated to match current output
- These changes reflect modifications to database queries or schema
Next steps:
- Review the query changes to ensure they're intentional
- If unexpected, investigate what caused the query to change
Query snapshots: Backend query snapshots updated
Changes: 1 snapshots (1 modified, 0 added, 0 deleted)
What this means:
- Query snapshots have been automatically updated to match current output
- These changes reflect modifications to database queries or schema
Next steps:
- Review the query changes to ensure they're intentional
- If unexpected, investigate what caused the query to change