Skip to content

: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.

feat(data-warehouse): improve onboarding source picker and table setup (#66297)

Tom Owers2bcde3def914
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index b7eabb89dddf..6958a7457ab4 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -7081,9 +7081,9 @@ snapshots:
scenes-other-onboarding--invite-teammates--light:
hash: v1.k794b7964.9eeb0a5a8dfe6dec0f305c56213c7435e21b59a4e43aa01a2ce17f68cb67245d.NHivw8NjyCDKjPEyosSA5-MKbZjW6TwWNGvZpPIs8oE
scenes-other-onboarding--link-data--dark:
- hash: v1.k794b7964.277478ac411e8602a54cbb06b46fb04271729562912ec6603bf7057dd79be599.vAruz5_q2S9VtwQIZR523sjXv7l9ssZOqvBjhmUKh8Q
+ hash: v1.k794b7964.2044216caa32f6cf72c737567f28d90288d78358ffe0eee00a99158608604411.sqZ4uGC3QJukCdxuxHtjpWOWHNFxnyZyZoJDsFiR3v4
scenes-other-onboarding--link-data--light:
- hash: v1.k794b7964.ecd5c5a50852efb899d5c44edb1d5fffac10cc98283152a3c6a28ef9d89c65c6.dGz_soY60SZDKhxvVkx1PcT_TibV2tiAS_28jwWxGZ4
+ hash: v1.k794b7964.f6e32ff6e7e6060d6d5c93673d1293439a0d78f7c41b2084f54fdb453f9431ea.P02zIsk71npFrOm6mlj1t0VyfyveRGnWDSOJRzEIZZo
scenes-other-onboarding--product-analytics-configuration--dark:
hash: v1.k794b7964.08af688052c51fafa75fdcdc3754e7289fc18fb53596a2e928daa418aa02859d.lTGrMS9pD0saS4FeHB0VzmPt5pJKMMHzVx2nVd95gEY
scenes-other-onboarding--product-analytics-configuration--light:
diff --git a/frontend/src/scenes/onboarding/legacy/data-warehouse/DataWarehouseQueryVariant.tsx b/frontend/src/scenes/onboarding/legacy/data-warehouse/DataWarehouseQueryVariant.tsx
index 2c432d155c70..43fd2e0a3346 100644
--- a/frontend/src/scenes/onboarding/legacy/data-warehouse/DataWarehouseQueryVariant.tsx
+++ b/frontend/src/scenes/onboarding/legacy/data-warehouse/DataWarehouseQueryVariant.tsx
@@ -319,6 +319,7 @@ function DataWarehouseQueryInner(): JSX.Element {
onComplete={handleSourceConnected}
featured
showWizard
+ autoConfigureTables
title="Choose a source"
subtitle="You can always connect more sources later."
/>
diff --git a/frontend/src/scenes/onboarding/legacy/data-warehouse/DataWarehouseValuePropVariant.tsx b/frontend/src/scenes/onboarding/legacy/data-warehouse/DataWarehouseValuePropVariant.tsx
index 93cba4f059a9..fccca5a55aea 100644
--- a/frontend/src/scenes/onboarding/legacy/data-warehouse/DataWarehouseValuePropVariant.tsx
+++ b/frontend/src/scenes/onboarding/legacy/data-warehouse/DataWarehouseValuePropVariant.tsx
@@ -174,6 +174,7 @@ function DataWarehouseValuePropInner(): JSX.Element {
onComplete={handleSourceConnected}
featured
showWizard
+ autoConfigureTables
title="Choose a source"
subtitle="You can always connect more sources later."
/>
diff --git a/frontend/src/scenes/onboarding/legacy/data-warehouse/OnboardingDataWarehouseSourcesStep.tsx b/frontend/src/scenes/onboarding/legacy/data-warehouse/OnboardingDataWarehouseSourcesStep.tsx
index 0845f0963142..f381f38c806f 100644
--- a/frontend/src/scenes/onboarding/legacy/data-warehouse/OnboardingDataWarehouseSourcesStep.tsx
+++ b/frontend/src/scenes/onboarding/legacy/data-warehouse/OnboardingDataWarehouseSourcesStep.tsx
@@ -43,7 +43,7 @@ export const OnboardingDataWarehouseSourcesStep: OnboardingStepComponentType = (
}}
featured
showWizard
- title="Choose from 20+ sources"
+ autoConfigureTables
subtitle="You can always connect more sources later."
/>
</OnboardingStep>
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx
index a0392e75cf2d..e3450c18c3ae 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx
@@ -143,6 +143,7 @@ interface NewSourcesWizardProps {
allowedSources?: ExternalDataSourceType[] // Filter to only show these source types
initialSource?: ExternalDataSourceType // Pre-select this source and start on step 2
hideBackButton?: boolean
+ autoConfigureTables?: boolean // Onboarding: pre-select all syncable tables for a one-click sync
sourceWizardLogicProps?: SourceWizardLogicProps
}
@@ -156,6 +157,7 @@ export function NewSourcesWizard(props: NewSourcesWizardProps): JSX.Element {
const sourceWizardLogicProps = {
onComplete: props.onComplete,
availableSources,
+ autoConfigureTables: props.autoConfigureTables,
}
return (
@@ -302,7 +304,7 @@ function InternalSourcesWizard(props: NewSourcesWizardProps): JSX.Element {
) : currentStep === 2 ? (
<SecondStep sourceWizardLogicProps={props.sourceWizardLogicProps} />
) : currentStep === 3 ? (
- <ThirdStep />
+ <ThirdStep autoConfigureTables={props.autoConfigureTables} />
) : currentStep === 4 ? (
<WebhookSetupStep sourceWizardLogicProps={props.sourceWizardLogicProps} />
) : currentStep === 5 ? (
@@ -496,8 +498,44 @@ function SecondStep({ sourceWizardLogicProps }: { sourceWizardLogicProps?: Sourc
)
}
-function ThirdStep(): JSX.Element {
- return <SchemaForm />
+function ThirdStep({ autoConfigureTables }: { autoConfigureTables?: boolean }): JSX.Element {
+ return autoConfigureTables ? <AutoConfigureTablesStep /> : <SchemaForm />
+}
+
+function AutoConfigureTablesStep(): JSX.Element {
+ const { databaseSchema } = useValues(sourceWizardLogic)
+ const [customize, setCustomize] = useState(false)
+
+ if (customize) {
+ return <SchemaForm />
+ }
+
+ const selectedCount = databaseSchema.filter((s) => s.should_sync).length
+
+ return (
+ <div className="flex flex-col gap-4">
+ {selectedCount === 0 ? (
+ <LemonBanner type="warning">
+ No tables could be auto-configured — they may all have permission errors. Use "Review and customize
+ tables" to inspect and fix them before syncing.
+ </LemonBanner>
+ ) : (
+ <LemonBanner type="info">
+ We've auto-configured {selectedCount} {selectedCount === 1 ? 'table' : 'tables'} with smart sync
+ defaults. Continue below to start importing, or review the configuration first.
+ </LemonBanner>
+ )}
+ <div>
+ <LemonButton
+ type="secondary"
+ onClick={() => setCustomize(true)}
+ data-attr="dwh-onboarding-customize-tables"
+ >
+ Review and customize tables
+ </LemonButton>
+ </div>
+ </div>
+ )
}
function WebhookSetupStep({
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
index 6e4e6f6a16eb..e172f67c08f5 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
@@ -295,6 +295,8 @@ export interface SourceWizardLogicProps {
availableSources: Record<string, SourceConfig>
/** When set, only these tables will be pre-selected and they cannot be deselected */
requiredTables?: string[]
+ /** Onboarding: pre-select every syncable table with smart defaults for a one-click sync */
+ autoConfigureTables?: boolean
}
export const sourceWizardLogic = kea<sourceWizardLogicType>([
@@ -1475,6 +1477,12 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
schema.sync_type = 'full_refresh'
}
}
+
+ // Onboarding one-click setup: opt every syncable table in (permission errors
+ // already continued above), so the user can sync the whole source in one click.
+ if (props.autoConfigureTables) {
+ schema.should_sync = true
+ }
}
if (showToast && !values.requiredTables) {
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts
index b3ea444475d1..e24c7c210440 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts
@@ -1,3 +1,7 @@
+import { expectLogic } from 'kea-test-utils'
+
+import api from 'lib/api'
+
import type { SourceConfig } from '~/queries/schema/schema-general'
import { initKeaTests } from '~/test/init'
import type { ExternalDataSourceSyncSchema } from '~/types'
@@ -746,4 +750,93 @@ describe('sourceWizardLogic', () => {
}
})
})
+
+ // Onboarding one-click setup: autoConfigureTables opts every syncable table in so the user
+ // can sync the whole source without touching the schema step.
+ describe('autoConfigureTables', () => {
+ const stripeSource = {
+ name: 'Stripe',
+ iconPath: '',
+ caption: null,
+ fields: [],
+ } as SourceConfig
+
+ const apiSchema = (overrides: Partial<ExternalDataSourceSyncSchema> = {}): ExternalDataSourceSyncSchema =>
+ ({
+ table: 'Customer',
+ label: null,
+ rows: null,
+ should_sync: false,
+ sync_time_of_day: null,
+ incremental_field: null,
+ incremental_field_type: null,
+ sync_type: null,
+ incremental_fields: [],
+ incremental_available: false,
+ append_available: false,
+ supports_webhooks: false,
+ description: null,
+ should_sync_default: true,
+ primary_key_columns: null,
+ available_columns: [],
+ detected_primary_keys: null,
+ permission_error: null,
+ cdc_available: false,
+ ...overrides,
+ }) as ExternalDataSourceSyncSchema
+
+ afterEach(() => {
+ jest.restoreAllMocks()
+ })
+
+ it('selects every syncable table and resolves sync defaults when set', async () => {
+ jest.spyOn(api.externalDataSources, 'database_schema').mockResolvedValue([
+ apiSchema({
+ table: 'Customer',
+ should_sync_default: false, // proves autoConfigureTables overrides the per-table default
+ incremental_available: true,
+ incremental_fields: [
+ { field: 'updated_at', field_type: 'datetime', label: 'updated_at', type: 'datetime' },
+ ],
+ }),
+ apiSchema({ table: 'Product', should_sync_default: false }),
+ apiSchema({ table: 'Charge', permission_error: 'Missing scope' }),
+ ] as ExternalDataSourceSyncSchema[])
+
+ const logic = sourceWizardLogic({ availableSources: { Stripe: stripeSource }, autoConfigureTables: true })
+ const unmount = logic.mount()
+
+ try {
+ logic.actions.selectConnector(stripeSource)
+ await expectLogic(logic, () => logic.actions.getDatabaseSchemas()).toFinishAllListeners()
+
+ const byTable = Object.fromEntries(logic.values.databaseSchema.map((s) => [s.table, s]))
+ expect(byTable['Customer'].should_sync).toBe(true)
+ expect(byTable['Customer'].sync_type).toBe('incremental')
+ expect(byTable['Customer'].incremental_field).toBe('updated_at')
+ expect(byTable['Product'].should_sync).toBe(true)
+ // permission_error rows can never be synced, even under auto-configure.
+ expect(byTable['Charge'].should_sync).toBe(false)
+ } finally {
+ unmount()
+ }
+ })
+
+ it('honours should_sync_default when not set', async () => {
+ jest.spyOn(api.externalDataSources, 'database_schema').mockResolvedValue([
+ apiSchema({ table: 'Product', should_sync_default: false }),
+ ] as ExternalDataSourceSyncSchema[])
+
+ const logic = sourceWizardLogic({ availableSources: { Stripe: stripeSource } })
+ const unmount = logic.mount()
+
+ try {
+ logic.actions.selectConnector(stripeSource)
+ await expectLogic(logic, () => logic.actions.getDatabaseSchemas()).toFinishAllListeners()
+ expect(logic.values.databaseSchema[0].should_sync).toBe(false)
+ } finally {
+ unmount()
+ }
+ })
+ })
})
diff --git a/products/data_warehouse/frontend/shared/components/InlineSourceSetup.tsx b/products/data_warehouse/frontend/shared/components/InlineSourceSetup.tsx
index a921cb48bac6..ee7d6ebccc4a 100644
--- a/products/data_warehouse/frontend/shared/components/InlineSourceSetup.tsx
+++ b/products/data_warehouse/frontend/shared/components/InlineSourceSetup.tsx
@@ -3,7 +3,7 @@ import { router } from 'kea-router'
import { useEffect, useState } from 'react'
import { IconDatabase, IconPlus } from '@posthog/icons'
-import { LemonButton, LemonCard, LemonSkeleton } from '@posthog/lemon-ui'
+import { LemonButton, LemonCard, LemonInput, LemonSkeleton } from '@posthog/lemon-ui'
import { ExternalDataSourceType, SourceConfig } from '~/queries/schema/schema-general'
@@ -25,20 +25,23 @@ export interface InlineSourceSetupProps {
onComplete?: () => void
/** When true, show only featured sources initially with an expand option to show all */
featured?: boolean
- /** Custom title for the source selection */
+ /** Custom title for the source selection. Defaults to the live source count. */
title?: string
/** Custom subtitle for the source selection */
subtitle?: string
/** When true, show the CLI wizard block as a fast path above the source grid (cloud/dev only) */
showWizard?: boolean
+ /** Pre-select all syncable tables with smart defaults so the user can sync in one click */
+ autoConfigureTables?: boolean
}
function InternalInlineSourceSetup({
onComplete,
featured = false,
- title = 'Connect a data source',
+ title,
subtitle = 'Choose a source to import data from',
showWizard = false,
+ autoConfigureTables = false,
}: InlineSourceSetupProps): JSX.Element {
const { connectors } = useValues(sourceWizardLogic)
const { onClear } = useActions(sourceWizardLogic)
@@ -48,6 +51,7 @@ function InternalInlineSourceSetup({
const [currentView, setCurrentView] = useState<InlineSourceSetupView>('selection')
const [selectedSource, setSelectedSource] = useState<ExternalDataSourceType | null>(null)
const [expanded, setExpanded] = useState(!featured)
+ const [searchQuery, setSearchQuery] = useState('')
// Filter out unreleased sources
const availableConnectors = connectors.filter((c: SourceConfig) => !c.unreleasedSource)
@@ -74,13 +78,24 @@ function InternalInlineSourceSetup({
}, [])
const featuredSources = availableConnectors.filter((c: SourceConfig) => c.featured)
const hiddenSources = availableConnectors.filter((c: SourceConfig) => !c.featured)
- const sourcesToShow = expanded ? availableConnectors : featuredSources
+
+ const trimmedQuery = searchQuery.trim().toLowerCase()
+ const isSearching = trimmedQuery.length > 0
+ // While searching, match across every source — the featured/expand split only applies
+ // to the default (unsearched) view.
+ const sourcesToShow = isSearching
+ ? availableConnectors.filter((c: SourceConfig) => (c.label ?? c.name).toLowerCase().includes(trimmedQuery))
+ : expanded
+ ? availableConnectors
+ : featuredSources
const sourceItems: SourceItem[] = sourcesToShow.map((source: SourceConfig) => ({
id: source.name,
label: source.label ?? source.name,
}))
+ const effectiveTitle = title ?? `Choose from ${availableConnectors.length} sources`
+
const handleSourceSelect = (sourceId: ExternalDataSourceType): void => {
setSelectedSource(sourceId)
setCurrentView('connecting')
@@ -110,27 +125,42 @@ function InternalInlineSourceSetup({
<IconDatabase className="w-7 h-7" style={{ color: 'var(--primary-3000)' }} />
</div>
<div>
- <h4 className="text-lg font-semibold">{title}</h4>
+ <h4 className="text-lg font-semibold">{effectiveTitle}</h4>
<p className="text-sm text-muted-alt">{subtitle}</p>
</div>
</div>
{showWizard && <DataWarehouseWizardBlock />}
- <div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3">
- {sourceItems.map((source) => (
- <div
- key={source.id}
- className="flex items-center gap-3 p-3 rounded-lg border border-border bg-bg-light cursor-pointer"
- onClick={() => handleSourceSelect(source.id)}
- >
- <SourceIcon type={source.id} size="small" disableTooltip />
- <span className="font-medium text-sm">{source.label}</span>
- </div>
- ))}
- </div>
+ <LemonInput
+ type="search"
+ placeholder="Search sources..."
+ value={searchQuery}
+ onChange={setSearchQuery}
+ fullWidth
+ autoFocus
+ />
+
+ {sourceItems.length > 0 ? (
+ <div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3">
+ {sourceItems.map((source) => (
+ <div
+ key={source.id}
+ className="flex items-center gap-3 p-3 rounded-lg border border-border bg-bg-light cursor-pointer"
+ onClick={() => handleSourceSelect(source.id)}
+ >
+ <SourceIcon type={source.id} size="small" disableTooltip />
+ <span className="font-medium text-sm">{source.label}</span>
+ </div>
+ ))}
+ </div>
+ ) : (
+ <p className="text-sm text-muted-alt text-center py-4">
+ No sources match "{searchQuery.trim()}".
+ </p>
+ )}
- {featured && !expanded && hiddenSources.length > 0 && (
+ {!isSearching && featured && !expanded && hiddenSources.length > 0 && (
<div className="flex justify-center pt-2">
<LemonButton
type="secondary"
@@ -161,6 +191,7 @@ function InternalInlineSourceSetup({
onComplete={handleFormSuccess}
allowedSources={availableConnectors.map((c: SourceConfig) => c.name)}
initialSource={selectedSource}
+ autoConfigureTables={autoConfigureTables}
/>
</div>
</LemonCard>