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): show queryable table name on the sync-complete step (#88188)

Tom Owersf1de8fbb085a
diff --git a/products/data_warehouse/frontend/shared/components/forms/SyncProgressStep.test.tsx b/products/data_warehouse/frontend/shared/components/forms/SyncProgressStep.test.tsx
index 0703180547ce..76f87c07b08e 100644
--- a/products/data_warehouse/frontend/shared/components/forms/SyncProgressStep.test.tsx
+++ b/products/data_warehouse/frontend/shared/components/forms/SyncProgressStep.test.tsx
@@ -1,6 +1,45 @@
-import { getPreviewQueryUrl, getSourceAccessMethod } from './SyncProgressStep'
+import { ExternalDataSourceSchema, SimpleDataWarehouseTable } from '~/types'
+
+import { getPreviewQueryUrl, getQueryableTableName, getSourceAccessMethod } from './SyncProgressStep'
+
+const buildTable = (overrides: Partial<SimpleDataWarehouseTable>): SimpleDataWarehouseTable => ({
+ id: 't',
+ name: 'table',
+ columns: [],
+ row_count: 0,
+ ...overrides,
+})
+
+const buildSchema = (overrides: Partial<ExternalDataSourceSchema>): ExternalDataSourceSchema =>
+ ({ name: 'drivers', ...overrides }) as ExternalDataSourceSchema
describe('SyncProgressStep', () => {
+ describe('getQueryableTableName', () => {
+ it('returns the prefixed table name when it differs from the label', () => {
+ expect(getQueryableTableName(buildSchema({ table: buildTable({ name: 'neon_drivers' }) }))).toEqual(
+ 'neon_drivers'
+ )
+ })
+
+ it('prefers the hogql name over the raw table name', () => {
+ expect(
+ getQueryableTableName(
+ buildSchema({ table: buildTable({ name: 'neon_drivers', hogql_name: 'drivers_v2' }) })
+ )
+ ).toEqual('drivers_v2')
+ })
+
+ it('returns undefined when the queryable name matches the label', () => {
+ expect(
+ getQueryableTableName(buildSchema({ label: 'drivers', table: buildTable({ name: 'drivers' }) }))
+ ).toBeUndefined()
+ })
+
+ it('returns undefined before the table has been created', () => {
+ expect(getQueryableTableName(buildSchema({ table: undefined }))).toBeUndefined()
+ })
+ })
+
it('prefers the wizard access method before the source has loaded', () => {
expect(getSourceAccessMethod('direct', undefined)).toEqual('direct')
})
diff --git a/products/data_warehouse/frontend/shared/components/forms/SyncProgressStep.tsx b/products/data_warehouse/frontend/shared/components/forms/SyncProgressStep.tsx
index 8c9a51ecc23f..acab9306e625 100644
--- a/products/data_warehouse/frontend/shared/components/forms/SyncProgressStep.tsx
+++ b/products/data_warehouse/frontend/shared/components/forms/SyncProgressStep.tsx
@@ -36,6 +36,17 @@ export function getPreviewQueryUrl(
return buildTableQueryUrl(tableName, accessMethod === 'direct' ? (sourceId ?? undefined) : undefined)
}
+// Synced tables are exposed under a prefixed name (e.g. schema "drivers" becomes "neon_drivers"),
+// but the row only shows the friendly schema label — so users try to query the label and hit
+// "Unknown table". Surface the real queryable name, but only when it differs from the label.
+export function getQueryableTableName(schema: ExternalDataSourceSchema): string | undefined {
+ const queryableName = schema.table?.hogql_name ?? schema.table?.name
+ if (!queryableName) {
+ return undefined
+ }
+ return queryableName === (schema.label ?? schema.name) ? undefined : queryableName
+}
+
export const SyncProgressStep = (): JSX.Element => {
const { sourceId, isWrapped, source: wizardSource, nextButtonText } = useValues(sourceWizardLogic)
const { cancelWizard, closeWizard } = useActions(sourceWizardLogic)
@@ -98,17 +109,30 @@ export const SyncProgressStep = (): JSX.Element => {
title: 'Table',
key: 'table',
render: function RenderTable(_, schema) {
- if (!schema.table) {
- return schema.label ?? schema.name
- }
-
- return (
+ const displayName = schema.label ?? schema.name
+ const queryableName = getQueryableTableName(schema)
+ const title = schema.table ? (
<Link
to={getPreviewQueryUrl(schema.table.name, sourceAccessMethod, sourceId)}
onClick={() => cancelWizard()}
>
- {schema.label ?? schema.name}
+ {displayName}
</Link>
+ ) : (
+ displayName
+ )
+
+ if (!queryableName) {
+ return title
+ }
+
+ return (
+ <div className="flex flex-col">
+ {title}
+ <Tooltip title="Query this table by this name in the SQL editor">
+ <code className="text-xs text-muted w-fit">{queryableName}</code>
+ </Tooltip>
+ </div>
)
},
},