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): show live row progress on schemas tab (#61939)

Javier Bahamondes8851b4845344
diff --git a/products/data_warehouse/frontend/scenes/SourceScene/tabs/SchemasTab.tsx b/products/data_warehouse/frontend/scenes/SourceScene/tabs/SchemasTab.tsx
index e1baecd8b6b0..9c9732f311ba 100644
--- a/products/data_warehouse/frontend/scenes/SourceScene/tabs/SchemasTab.tsx
+++ b/products/data_warehouse/frontend/scenes/SourceScene/tabs/SchemasTab.tsx
@@ -28,7 +28,12 @@ import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
import { ExternalDataSourceType, ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
-import { DataWarehouseSyncInterval, ExternalDataSource, ExternalDataSourceSchema } from '~/types'
+import {
+ DataWarehouseSyncInterval,
+ ExternalDataSchemaStatus,
+ ExternalDataSource,
+ ExternalDataSourceSchema,
+} from '~/types'
import { DATA_WAREHOUSE_APP_SOURCE } from 'products/data_warehouse/frontend/shared/components/metrics/DataWarehouseMetrics'
import {
@@ -105,10 +110,19 @@ function ManagedSchemasTab({ id }: { id: string }): JSX.Element {
resyncSchema,
cancelSchema,
deleteTable,
+ loadJobs,
} = useActions(sourceSettingsLogic)
const { addProductIntentForCrossSell } = useActions(teamLogic)
const { featureFlags } = useValues(featureFlagLogic)
+ // Load (and poll) jobs so the Rows synced column can show live progress for in-progress
+ // syncs, before the warehouse table exists. loadJobsSuccess reschedules itself.
+ useEffect(() => {
+ if (source && source.access_method !== 'direct') {
+ loadJobs()
+ }
+ }, [loadJobs, source])
+
const showMetrics = !!featureFlags[FEATURE_FLAGS.DWH_SOURCE_METRICS]
// `id` is the cleaned source id; URLs use the `managed-` prefix
const prefixedSourceId = `managed-${id}`
@@ -283,6 +297,7 @@ function ManagedSchemaTable({
showMetrics,
}: ManagedSchemaTableProps): JSX.Element {
const { schemaReloadingById } = useValues(sourceManagementLogic)
+ const { inProgressRowsBySchema } = useValues(sourceSettingsLogic)
const { setSelectedSchemas } = useActions(sourceSettingsLogic)
const { disabledReason: editDisabledReason } = useSourceEditorAccess(source)
const [initialLoad, setInitialLoad] = useState(true)
@@ -405,7 +420,17 @@ function ManagedSchemaTable({
if (schema.table) {
return schema.table.row_count?.toLocaleString() ?? 0
}
- if (schema.status === 'Completed') {
+ // No table yet during the first sync — fall back to the running job's live count.
+ if (schema.status === ExternalDataSchemaStatus.Running) {
+ const rows = inProgressRowsBySchema[schema.id] ?? 0
+ return (
+ <span className="flex items-center justify-end gap-1">
+ <Spinner textColored className="text-sm" />
+ {rows.toLocaleString()}
+ </span>
+ )
+ }
+ if (schema.status === ExternalDataSchemaStatus.Completed) {
return 0
}
return <span className="text-muted">—</span>
diff --git a/products/data_warehouse/frontend/scenes/SourceScene/tabs/sourceSettingsLogic.ts b/products/data_warehouse/frontend/scenes/SourceScene/tabs/sourceSettingsLogic.ts
index a6e483df348f..b4f548c66404 100644
--- a/products/data_warehouse/frontend/scenes/SourceScene/tabs/sourceSettingsLogic.ts
+++ b/products/data_warehouse/frontend/scenes/SourceScene/tabs/sourceSettingsLogic.ts
@@ -502,6 +502,22 @@ export const sourceSettingsLogic = kea<sourceSettingsLogicType>([
return availableSources[source.source_type]
},
],
+ // Live row counts for in-progress syncs, keyed by schema id. Lets the Schemas tab show
+ // progress during the first sync — before the warehouse table (and its row_count) exists,
+ // the table column has nothing to render, so we fall back to the running job's rows_synced.
+ inProgressRowsBySchema: [
+ (s) => [s.jobs],
+ (jobs): Record<string, number> => {
+ const map: Record<string, number> = {}
+ // jobs arrive newest-first; keep the first (latest) running job per schema.
+ for (const job of jobs) {
+ if (job.status === ExternalDataJobStatus.Running && !(job.schema.id in map)) {
+ map[job.schema.id] = job.rows_synced
+ }
+ }
+ return map
+ },
+ ],
filteredSchemas: [
(s) => [
s.source,