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.

fix(data-warehouse): stop full-refresh tables reading as unconfigured (#106755)

Tom Owersc89525695c58
diff --git a/products/data_warehouse/frontend/shared/components/forms/SchemaForm.test.ts b/products/data_warehouse/frontend/shared/components/forms/SchemaForm.test.ts
index 31b0e8cc2551..4561dbdc796f 100644
--- a/products/data_warehouse/frontend/shared/components/forms/SchemaForm.test.ts
+++ b/products/data_warehouse/frontend/shared/components/forms/SchemaForm.test.ts
@@ -1,6 +1,6 @@
import type { ExternalDataSourceSyncSchema } from '~/types'
-import { getDirectQuerySelectionDescription } from './SchemaForm'
+import { getDirectQuerySelectionDescription, getSyncFieldPlaceholder } from './SchemaForm'
import { getDefaultExpandedSchemaKeys, groupTablesBySchema, splitQualifiedTableName } from './schemaGroupingUtils'
const makeSchema = (table: string): ExternalDataSourceSyncSchema => ({
@@ -33,6 +33,16 @@ describe('SchemaForm', () => {
)
})
+ it.each([
+ ['full_refresh', 'Not needed for this sync method'],
+ ['cdc', 'Not needed for this sync method'],
+ ['incremental', 'No sync field selected'],
+ ['append', 'No sync field selected'],
+ [null, 'No sync field selected'],
+ ] as const)('labels the sync field cell for a %s table', (syncType, expected) => {
+ expect(getSyncFieldPlaceholder(syncType)).toEqual(expected)
+ })
+
it('splits fully qualified table names into schema and table labels', () => {
expect(splitQualifiedTableName('public.events')).toEqual({
schemaName: 'public',
diff --git a/products/data_warehouse/frontend/shared/components/forms/SchemaForm.tsx b/products/data_warehouse/frontend/shared/components/forms/SchemaForm.tsx
index 15b477346406..aaa5962344fd 100644
--- a/products/data_warehouse/frontend/shared/components/forms/SchemaForm.tsx
+++ b/products/data_warehouse/frontend/shared/components/forms/SchemaForm.tsx
@@ -36,6 +36,16 @@ export function getDirectQuerySelectionDescription(selectedSchema?: string | nul
return "Query selected Postgres tables from within PostHog. Tables stay in the source database and are not synced into the data warehouse. You can't join data from these tables with other data in the PostHog warehouse. Enable each schema to choose which tables should be queryable."
}
+// A full refresh replaces the whole table and CDC streams the replication log, so neither keys on
+// a field. Reporting those as "No sync field selected" reads as a table the user still has to
+// configure, which is what makes a long table list look full of problems.
+export function getSyncFieldPlaceholder(syncType: ExternalDataSourceSyncSchema['sync_type']): string {
+ if (syncType === 'full_refresh' || syncType === 'cdc') {
+ return 'Not needed for this sync method'
+ }
+ return 'No sync field selected'
+}
+
function getSchemaSelectionState(tables: ExternalDataSourceSyncSchema[]): boolean | 'indeterminate' {
const enabledCount = tables.filter((table) => table.should_sync).length
@@ -237,7 +247,9 @@ export default function SchemaForm(): JSX.Element {
}
}
- return <span className="text-xs text-muted-foreground">No sync field selected</span>
+ return (
+ <span className="text-xs text-muted-foreground">{getSyncFieldPlaceholder(schema.sync_type)}</span>
+ )
},
},
{
@@ -249,7 +261,7 @@ export default function SchemaForm(): JSX.Element {
isHidden: !shouldShowSyncColumns || !databaseSchema.some((schema) => schema.sync_type === 'incremental'),
render: function RenderPrimaryKey(_: unknown, schema: ExternalDataSourceSyncSchema) {
if (schema.sync_type !== 'incremental') {
- return <span className="text-xs text-muted-foreground">No primary key selected</span>
+ return <span className="text-xs text-muted-foreground">Only used for incremental syncs</span>
}
if (!schema.primary_key_columns || schema.primary_key_columns.length === 0) {