: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(data_warehouse): improve empty schema detection and messaging (#113461)
Anna Szell61c007b5f4bd
diff --git a/products/data_warehouse/frontend/scenes/SourceScene/tabs/SchemasTab.tsx b/products/data_warehouse/frontend/scenes/SourceScene/tabs/SchemasTab.tsxindex 773574d60302..a82c4a3e3c3d 100644--- a/products/data_warehouse/frontend/scenes/SourceScene/tabs/SchemasTab.tsx+++ b/products/data_warehouse/frontend/scenes/SourceScene/tabs/SchemasTab.tsx@@ -12,6 +12,7 @@ import {LemonSwitch,LemonTable,LemonTag,+ LemonTagType,Spinner,Tooltip,} from '@posthog/lemon-ui'@@ -76,6 +77,40 @@ const schemaEditDisabledReason = (schema: ExternalDataSourceSchema): string | nuconst dimWhenNotSyncing = (_: unknown, schema: ExternalDataSourceSchema): string =>schema.should_sync ? '' : 'opacity-60'+interface SchemaStatusDisplay {+ type: LemonTagType+ label: string+ tooltip: string | null+}++const schemaStatusDisplay = (+ schema: ExternalDataSourceSchema,+ status: ExternalDataSchemaStatus+): SchemaStatusDisplay => {+ // An empty table after a completed sync usually means a row filter that matches nothing, a missing+ // permission, or an empty source. An incremental sync that finds no new rows still leaves rows in+ // the table, so it doesn't trigger this.+ const completedWithNoRows =+ status === ExternalDataSchemaStatus.Completed &&+ !!schema.last_synced_at &&+ (schema.table ? schema.table.row_count === 0 : true)+ if (completedWithNoRows) {+ const filterHint = schema.row_filters?.length+ ? ' Check that the row filters on this table match some rows.'+ : ''+ return {+ type: 'warning',+ label: 'Completed, no rows',+ tooltip: `The sync finished but brought in no rows. Check that the source has data and that the account you connected can read it.${filterHint} Open the sync logs for details.`,+ }+ }+ return {+ type: StatusTagSetting[status] || 'default',+ label: status,+ tooltip: status === ExternalDataSchemaStatus.Failed ? (schema.latest_error ?? null) : null,+ }+}+export interface SchemasTabProps {id: string}@@ -453,17 +488,14 @@ function ManagedSchemaTable({}).url)}+ const { type, label, tooltip } = schemaStatusDisplay(schema, schema.status)const tagContent = (- <LemonTag- type={StatusTagSetting[schema.status] || 'default'}- forceClickable- onClick={openSyncsForSchema}- >- {schema.status}+ <LemonTag type={type} forceClickable onClick={openSyncsForSchema}>+ {label}</LemonTag>)- return schema.latest_error && schema.status === 'Failed' ? (- <Tooltip title={schema.latest_error} interactive>+ return tooltip ? (+ <Tooltip title={tooltip} interactive>{tagContent}</Tooltip>) : (