Repository navigation
feat(data-warehouse): add direct_query_enabled toggle to data sources - #64685
Conversation
|
Query snapshots: Backend query snapshots updatedChanges: 7 snapshots (7 modified, 0 added, 0 deleted) What this means:
Next steps:
|
πΈοΈ Eager graphHow much code each root forces the browser to download and decode through static imports β the regression class total bundle size can't see.
β
Largest files eagerly reachable from
|
| Size | File |
|---|---|
| 886.1 KiB | src/styles/global.scss |
| 609.0 KiB | public/hedgehog/burning-money-hog.png |
| 541.9 KiB | public/hedgehog/waving-hog.png |
| 448.2 KiB | public/hedgehog/stop-sign-hog.png |
| 362.0 KiB | public/hedgehog/phone-pair-hogs.png |
| 354.8 KiB | ../node_modules/.pnpm/@posthog+icons@0.36.6_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js |
| 335.6 KiB | public/hedgehog/desk-hog.png |
| 329.6 KiB | src/taxonomy/core-filter-definitions-by-group.json |
| 323.2 KiB | public/hedgehog/3-bears-hogs.png |
| 292.5 KiB | src/lib/api.ts |
Largest files eagerly reachable from src/scenes/AuthenticatedShell.tsx
| Size | File |
|---|---|
| 886.1 KiB | src/styles/global.scss |
| 764.5 KiB | src/queries/validators.js |
| 609.0 KiB | public/hedgehog/burning-money-hog.png |
| 541.9 KiB | public/hedgehog/waving-hog.png |
| 448.2 KiB | public/hedgehog/stop-sign-hog.png |
| 362.0 KiB | public/hedgehog/phone-pair-hogs.png |
| 354.8 KiB | ../node_modules/.pnpm/@posthog+icons@0.36.6_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js |
| 335.6 KiB | public/hedgehog/desk-hog.png |
| 329.6 KiB | src/taxonomy/core-filter-definitions-by-group.json |
| 323.2 KiB | public/hedgehog/3-bears-hogs.png |
Posted automatically by check-eager-graph Β· sizes are input-source bytes from the esbuild metafile Β· part of #32479
|
Size Change: 0 B Total Size: 64.5 MB βΉοΈ View Unchanged
|
|
βοΈ Skipped snapshot commit because branch advanced to 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:
|
Migration SQL ChangesHey π, we've detected some migrations on this PR. Here's the SQL output for each migration, make sure they make sense:
|
π Migration Risk AnalysisWe've analyzed your migrations for potential risks. Summary: 1 Safe | 1 Needs Review | 0 Blocked
|
Query snapshots: Backend query snapshots updatedChanges: 2 snapshots (2 modified, 0 added, 0 deleted) What this means:
Next steps:
|
Add a per-source `direct_query_enabled` boolean to ExternalDataSource so a synced (warehouse) source can be marked live-queryable via direct connection. The field is dormant: nothing reads it for enforcement yet, and existing synced sources are backfilled disabled, so behavior is unchanged until a source is explicitly enabled. Exposed (with help_text) on the create and detail/update serializers β create honors it, PATCH toggles it β with regenerated OpenAPI/frontend/MCP types. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The one-shot/MCP `setup` action couldn't opt a synced source out of direct query at creation time β `SourceSetupSerializer` had no field, so it always created with the default. Add the field and thread it through, matching the create endpoint. Also collapse the two create-path tests into one parameterized test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Batch the 0025 backfill (filtered bulk update per chunk with pauses) so it never holds row locks across the whole table at once, matching this app's existing backfill convention. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Master added 0024_alter_externaldataschema_sync_type, colliding with the direct_query_enabled migrations. Renumber them to 0025/0026 after it and update the dependency chain, max_migration.txt, and the migration test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
6cf6df3 to
fb589b1
Compare
β¦o avoid 0025 collision with master Rename migrations 0025β0026 and 0026β0027 after master merged 0025_alter_externaldatasource_source_type_and_more; update dependencies and max_migration.txt accordingly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| # Generated by Django 5.2.14 on 2026-06-18 17:26 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("warehouse_sources", "0025_alter_externaldatasource_source_type_and_more"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="externaldatasource", | ||
| name="direct_query_enabled", | ||
| field=models.BooleanField(default=True), | ||
| ), | ||
| ] |
There was a problem hiding this comment.
CRITICAL: Duplicate migration conflict
There are two migration files attempting to add the same direct_query_enabled field:
0025_externaldatasource_direct_query_enabled.py(depends on0024_alter_externaldataschema_sync_type)0026_externaldatasource_direct_query_enabled.py(depends on0025_alter_externaldatasource_source_type_and_more)
Both migrations run AddField for the same column, which will cause a database error when the second one tries to add a column that already exists. This indicates a merge conflict from parallel migration branches that wasn't properly resolved.
Impact: Migrations will fail in production with "column already exists" error.
Fix: Remove the duplicate migration files and consolidate into a single migration sequence. Keep only one set:
# Keep 0025 that adds the field
# Keep 0026 that does the backfill
# Remove duplicate 0026 (add field) and 0027 (backfill)| # Generated by Django 5.2.14 on 2026-06-18 17:26 | |
| from django.db import migrations, models | |
| class Migration(migrations.Migration): | |
| dependencies = [ | |
| ("warehouse_sources", "0025_alter_externaldatasource_source_type_and_more"), | |
| ] | |
| operations = [ | |
| migrations.AddField( | |
| model_name="externaldatasource", | |
| name="direct_query_enabled", | |
| field=models.BooleanField(default=True), | |
| ), | |
| ] | |
| # Generated by Django 5.2.14 on 2026-06-18 17:26 | |
| from django.db import migrations, models | |
| class Migration(migrations.Migration): | |
| dependencies = [ | |
| ("warehouse_sources", "0025_alter_externaldatasource_source_type_and_more"), | |
| ("warehouse_sources", "0025_externaldatasource_direct_query_enabled"), | |
| ] | |
| operations = [ | |
| ] | |
Spotted by Graphite
Is this helpful? React π or π to let us know.
There was a problem hiding this comment.
Fixed β the duplicate 0025_externaldatasource_direct_query_enabled.py and 0026_backfill files have been deleted; the migration chain is now 0025_alter_externaldatasource_source_type_and_more -> 0026_externaldatasource_direct_query_enabled -> 0027_backfill_externaldatasource_direct_query_enabled.
β¦merge conflict resolution Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| migrate_from = "0025_externaldatasource_direct_query_enabled" | ||
| migrate_to = "0026_backfill_externaldatasource_direct_query_enabled" |
There was a problem hiding this comment.
Migration test references non-existent migration names. The test will fail to run because these migration files don't exist.
The actual migrations are:
0026_externaldatasource_direct_query_enabled(adds the field)0027_backfill_externaldatasource_direct_query_enabled(backfills)
But the test references:
0025_externaldatasource_direct_query_enabled(doesn't exist)0026_backfill_externaldatasource_direct_query_enabled(doesn't exist)
Fix:
migrate_from = "0026_externaldatasource_direct_query_enabled"
migrate_to = "0027_backfill_externaldatasource_direct_query_enabled"| migrate_from = "0025_externaldatasource_direct_query_enabled" | |
| migrate_to = "0026_backfill_externaldatasource_direct_query_enabled" | |
| migrate_from = "0026_externaldatasource_direct_query_enabled" | |
| migrate_to = "0027_backfill_externaldatasource_direct_query_enabled" | |
Spotted by Graphite
Is this helpful? React π or π to let us know.
There was a problem hiding this comment.
Fixed β migrate_from and migrate_to updated to reference the renumbered migrations 0026 and 0027.
β¦grations 0026/0027 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
β¦eld list test Test was asserting the serializer field list but missed the new direct_query_enabled field added by this PR. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
β¦ claude/sad-poincare-d9b339
β¦r merge Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
β¦ter_externaldatasource Master landed 0026_alter_externaldatasource_source_type_and_more, causing a leaf-node conflict with our 0026_externaldatasource_direct_query_enabled. Renumber: 0026_externaldatasource_direct_query_enabled β 0027 0027_backfill_externaldatasource_direct_query_enabled β 0028 Also updates max_migration.txt and the migration test references. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
β¦-d9b339 # Conflicts: # products/warehouse_sources/backend/migrations/max_migration.txt
β¦fill-admin * origin/master: (203 commits) fix(experiments): add missing event properties to the backend events on the recalculation workflow. (#64923) refactor(capture): decouple v1 RequestContext from analytics Context (#64184) feat(data-warehouse): add direct_query_enabled toggle to data sources (#64685) feat(data-warehouse): persist duckling bucket on DuckgresServer (#64919) fix(dev): strip read-denied $HOME dirs from sandbox PATH (#64768) fix(mcp-analytics): keep muted text readable inside quill subtrees (#64898) feat(skills): add Scouts tab backed by a generic skill category (#64796) fix(ducklake): make get_instance_region a lazy import in common helpers (#64913) fix(replay-vision): drop vestigial scanner_type from VisionAction selection (#64737) feat(warehouse): add xmin read path for postgres source (#64721) feat(warehouse): add per-table xmin sync radio (flag-gated) (#64718) feat(warehouse): validate xmin sync type and surface availability (#64723) fix(data-warehouse): CDC improvements β fix dead orphan-slot sweeper (#64725) feat(data-warehouse): scaffold Razorpay source (#64484) fix(dags): read duckling backfill bucket from stored catalog (#64909) feat(inbox): add archived tab with restore (#64876) feat(signals): surface a banner when inbox filters are active (#64811) fix(lemon-dialog): isolate nested form dialogs with unique kea logic keys (#62113) feat(session-replay): show event triggers on mobile replay settings tab (#64859) fix(preflight): restore kafka connectivity probe (#58743) ...
Problem
Synced (warehouse) SQL sources can't be queried live in the SQL editor today β only pure direct-query sources can. Phase 1 of direct connect adds that, and it needs a per-source switch so a synced source can opt into being live-queryable without forcing it on every source or coupling it to the immutable
access_method.Changes
Adds
direct_query_enabled(boolean) toExternalDataSource:true.ADD COLUMN) plus a separate backfill that disables it on existing synced sources (access_method=warehouse) and leaves pure-direct sources enabled.help_texton the create and detail/update serializers β create honors it,PATCHtoggles it. Regenerated OpenAPI / frontend / MCP types.The field is dormant: nothing reads it for enforcement yet (that lands in a later PR in this series), and existing synced sources are backfilled disabled, so nothing changes until a source is explicitly enabled.
How did you test this code?
I'm an agent (Claude Code). Automated tests run locally:
false;PATCHtoggles the field.test_direct_postgres_query+test_direct_mysql_query(128) green; the existing create/PATCHsuite for this endpoint green.hogli build:openapiregenerated;ruffand frontendtypescript:checkclean (no new errors).No manual UI testing β there is no UI surface yet; the field is API-only at this stage.
Automatic notifications
Docs update
No docs change β the field is internal and dormant until the activation PR.
π€ Agent context
Autonomy: Human-driven (agent-assisted)
Implemented by Claude Code (Opus 4.8) as agent "A2" in a multi-PR direct-connect series. Daniel directed the work and is the DRI.
Skills invoked:
/django-migrations(split additive column from backfill, verifiedsqlmigrateis metadata-only, confirmed no external raw-INSERTwriters of the table so nodb_defaultis needed) and/improving-drf-endpoints(every field carrieshelp_text; verified generated JSDoc and MCP tool schemas).Decisions:
0024) from backfill (0025), matching this app's existing convention, so the fast DDL doesn't share a transaction with the data update._create_external_data_sourcerather than only exposing it on the serializer, so an explicitdirect_query_enabled=falseat creation is honored instead of silently ignored.