: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
feat(data-warehouse): improve person-property custom property UX (#72607)
Tom Owersc3b8000bcfb2
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 8e90d2f54e40..3ec1ad53942a 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -1709,9 +1709,9 @@ snapshots:components-search--product-recents-and-starred--light:hash: v1.k794b7964.5df9ac27e8f914736f6fc30fbe27aba42d686145e0f06982dfe1050b74931081.9snshG25bFXRzfMF4nFJgaB7uHRXkt-2Du2b_Qoi9Lwcomponents-search--searching--dark:- hash: v1.k794b7964.77bd7a31780e5f8105a42bb3ef95665ed3fd3a848a75a703e909f10d2738c54e.nJw5vNOYctqCA_ZWrRooTsXyujJCPakKb8yA-kfebBo+ hash: v1.k794b7964.290bfa4a2a6e49770661d45646711b5755aea5d9b89ae5196c21e217dc8f8e82.QuKpgiWzYoz9LP7dmTh1ha4v5i-dFSI5fMpLWTGtVi0components-search--searching--light:- hash: v1.k794b7964.a9fefe00552ca262ba439ee76c5628b5442a913f46f543cf069fe3e884b60e17.NgwGotLfLs1eTvISy-Ou2T4rhXEGFZFKFLppAuk4bs8+ hash: v1.k794b7964.24bc3ddb258e9a945dc9162929f53a48995d937d8ae69abff655145321bd190a.JCxCMyMt3v-oFLNXFgr_mHYfpz_lWSQc6vNy9Dz_enIcomponents-sentencelist--full-sentence--dark:hash: v1.k794b7964.7e8e5dd2e09d246cc3668f362f2391fe67618bd1143aa393832297f5dc30e558.yptEWKc5RAUY613Fwd5cQ0VIinMvpdoI6cuKgagAGxkcomponents-sentencelist--full-sentence--light:@@ -6991,9 +6991,9 @@ snapshots:scenes-app-settings-environment--settings-environment-privacy--light:hash: v1.k794b7964.8a66709400822bfa0ce716ad8ab87c844f6e255d6d147ffc1d0786ae6f0c88a4.YpDwS8AJgUCgRHrbfP00tREEmFzdh7uSlh1jUPiZwgkscenes-app-settings-environment--settings-environment-product-analytics--dark:- hash: v1.k794b7964.9bd3741e0130a71fb700118dae6f2c3379f3d02f420f7d6f4fccd0b2a0251c93.h0OB49ad-2x_37CoqSuB0OWzgKDpq87MZoJwG2uG6Zc+ hash: v1.k794b7964.e46fa3c909c28face78dfae63a4ab350c0e72d90db7d3e02b4b5c753d03ab859.312o8Z4ytSG78A2fKFuTAFQShpVOC9RpzmifF_-NruUscenes-app-settings-environment--settings-environment-product-analytics--light:- hash: v1.k794b7964.42878951a5a737ae797432ce85c2cbf0763fb9ac3a62eb1e47d20151a3e278d5.k-NnRkG14-uobsxt6XWRHYJNmy15Kba83FzaYuIWe3k+ hash: v1.k794b7964.9a08e3e1fb4186b60869058156d40c9eba697c61fdce90285a8f6743627df6f5.WTaXZbeJI75XsBB3A2ZoyoRd00iF1tY-HgnpKQeyrfcscenes-app-settings-environment--settings-environment-replay--dark:hash: v1.k794b7964.420f87c12f0437816ce82f7e13a45851e78a6e84198cbd81262c964a90bdc47e.CaLkZAptUT5gtkAbv8PMsSfuCUSfKnhks4ojIwUks0Escenes-app-settings-environment--settings-environment-replay--light:@@ -7063,9 +7063,9 @@ snapshots:scenes-app-settings-project--settings-project-integrations--light:hash: v1.k794b7964.1934174417b65042ff2e3e967e833f604198ee713c7f7711f67b57646d9326a1.DxQZ3xs0WrHP48Y9r13SVaHcJsN4h1KJVK-NSPUSXpgscenes-app-settings-project--settings-project-product-analytics--dark:- hash: v1.k794b7964.45ea7514f9bccedbd5ae65668dd7371f224a979516841725244f373eeff5368e.evnI8G2A5e-j4FXrMDySKcCpeXKTFgOOS_Ke0u_72qc+ hash: v1.k794b7964.3f634bc4aac18546bf8fd6e3659503abe7c9445f42f2ece46bd6d3e249015657.YenI6E3QU90yUtSj4KzcYV3n3k-6TTnZv8u4cfpXbbwscenes-app-settings-project--settings-project-product-analytics--light:- hash: v1.k794b7964.60b35997018c27307f9b9095cafa3a7ff618d500769e8c2f65f3ad43b54d2310.aMhUrmnvzq6XNQFQN0iwciI3HhAWPfRLX9NAuyaszGQ+ hash: v1.k794b7964.fb3506a82dd925f1778507d5f47eccc9b7dff193009a011dea95f777f24cda4d.bpSiJsX6URAvrJj60XvGbEnM2WTogoHagn9YkPlS3AYscenes-app-settings-project--settings-project-replay--dark:hash: v1.k794b7964.420f87c12f0437816ce82f7e13a45851e78a6e84198cbd81262c964a90bdc47e.MbG5FcxBuIFHRdrwoHEbyKJb_Pz8doVuDwvq1AaJeXMscenes-app-settings-project--settings-project-replay--light:diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.tsindex 1854ae55e1d6..9bdffeb5a0c8 100644--- a/frontend/src/lib/api.ts+++ b/frontend/src/lib/api.ts@@ -5671,8 +5671,14 @@ const api = {},dataWarehouseTables: {- async list(): Promise<PaginatedResponse<DataWarehouseTable>> {- return await new ApiRequest().dataWarehouseTables().get()+ async list(params?: {+ limit?: number+ include_columns?: boolean+ }): Promise<PaginatedResponse<DataWarehouseTable>> {+ return await new ApiRequest()+ .dataWarehouseTables()+ .withQueryString(params ?? {})+ .get()},async get(tableId: DataWarehouseTable['id']): Promise<DataWarehouseTable> {return await new ApiRequest().dataWarehouseTable(tableId).get()diff --git a/frontend/src/scenes/settings/SettingsMap.tsx b/frontend/src/scenes/settings/SettingsMap.tsxindex ba6a7fe9e088..cc62d739aaf9 100644--- a/frontend/src/scenes/settings/SettingsMap.tsx+++ b/frontend/src/scenes/settings/SettingsMap.tsx@@ -48,6 +48,7 @@ import { GeneralSection } from 'products/conversations/frontend/scenes/settings/import { NotificationsSection } from 'products/conversations/frontend/scenes/settings/NotificationsSection'import { ZendeskImportSection } from 'products/conversations/frontend/scenes/settings/ZendeskImportSection'import { CustomerAnalyticsAccountConfig } from 'products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomerAnalyticsAccountConfig'+import { WarehousePersonPropertiesSetting } from 'products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/WarehousePersonPropertiesSetting'import { CustomerAnalyticsDashboardEvents } from 'products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/events/CustomerAnalyticsDashboardEvents'import { ExceptionAutocaptureToggle } from 'products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/exception_autocapture/ExceptionAutocaptureSettings'import { SuppressionRules } from 'products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/suppression_rules/SuppressionRules'@@ -903,6 +904,15 @@ export const SETTINGS_MAP: SettingSection[] = [component: <PersonDisplayNameProperties />,keywords: ['name', 'email', 'identity', 'display'],},+ {+ id: 'warehouse-person-properties',+ title: 'Person properties from the warehouse',+ description:+ 'Sync columns from a data warehouse table onto matching people as person properties, usable in feature flags, cohorts and insights.',+ component: <WarehousePersonPropertiesSetting />,+ flag: 'WAREHOUSE_PERSON_PROPERTIES',+ keywords: ['warehouse', 'person', 'properties', 'sync', 'custom property'],+ },{id: 'person-last-seen-at',title: 'Person last seen tracking',diff --git a/frontend/src/scenes/settings/types.ts b/frontend/src/scenes/settings/types.tsindex 3545e0860715..fbe5dfca9e87 100644--- a/frontend/src/scenes/settings/types.ts+++ b/frontend/src/scenes/settings/types.ts@@ -211,6 +211,7 @@ export type SettingId =| 'path-cleaning'| 'person-display-name'| 'person-last-seen-at'+ | 'warehouse-person-properties'| 'personal-api-keys'| 'personal-integrations-github'| 'personal-integrations-slack'diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex 98006e962f95..e5765f87ceae 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -6013,6 +6013,10 @@ export interface DataWarehouseTable {/** UUID */id: stringname: string+ /** Dotted name the table is queried by in HogQL (e.g. `stripe.charges`), as opposed to `name` (the storage identifier). */+ hogql_name?: string+ /** Serialized columns; omitted when the table was listed with `include_columns=false`. */+ columns?: DatabaseSchemaField[]format: DataWarehouseTableTypesurl_pattern: string/** Null for tables without user-provided credentials, e.g. created by a managed pipeline. */diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertiesConfig.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertiesConfig.tsxindex e26fdf37b09b..3e265afcc14c 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertiesConfig.tsx+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertiesConfig.tsx@@ -56,9 +56,25 @@ export function CustomPropertiesConfig(): JSX.Element {dataIndex: 'name',render: (_, definition) => <span className="font-semibold">{definition.name}</span>,},+ {+ title: 'Attach to',+ render: (_, definition) =>+ definition.target_type === 'person' ? (+ <LemonTag type="completion">Person</LemonTag>+ ) : (+ <LemonTag type="default">Account</LemonTag>+ ),+ },{title: 'Type',- render: (_, definition) => labelForDisplayType(definition.display_type),+ // display_type only shapes how an account property renders; a person property is a raw+ // $set value, so there's nothing meaningful to show for it.+ render: (_, definition) =>+ definition.target_type === 'person' ? (+ <span className="text-secondary">—</span>+ ) : (+ labelForDisplayType(definition.display_type)+ ),},{title: 'Description',@@ -137,7 +153,7 @@ export function CustomPropertiesConfig(): JSX.Element {<h3 className="mb-0">Custom properties</h3><p className="text-secondary mb-0">Define typed properties to store on your accounts.</p></div>- <LemonButton type="primary" onClick={openCreateModal} disabledReason={restrictionReason}>+ <LemonButton type="primary" onClick={() => openCreateModal()} disabledReason={restrictionReason}>New custom property</LemonButton></div>diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertyModal.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertyModal.tsxindex 574b24040ff8..1d31f0c2f813 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertyModal.tsx+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/CustomPropertyModal.tsx@@ -20,6 +20,7 @@ import {import type { DataColorToken } from 'lib/colors'import { FEATURE_FLAGS } from 'lib/constants'import { LemonField } from 'lib/lemon-ui/LemonField'+import { LemonInputSelect } from 'lib/lemon-ui/LemonInputSelect/LemonInputSelect'import { LemonSegmentedButton } from 'lib/lemon-ui/LemonSegmentedButton'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { urls } from 'scenes/urls'@@ -53,14 +54,22 @@ const TARGET_TYPE_OPTIONS: { value: CustomPropertyTargetType; label: string }[]// column → person-property mappings. The binding + mappings are create-only on the backend, so// they're read-only once a source exists (only the key column + enabled switch stay editable).function PersonSourceEditor(): JSX.Element {- const { customPropertyForm, warehouseTables, warehouseTablesLoading, editingDefinition, columnMappingWarnings } =- useValues(customPropertyDefinitionsLogic)- const { setCustomPropertyFormValue } = useActions(customPropertyDefinitionsLogic)+ const {+ customPropertyForm,+ warehouseTables,+ warehouseTablesLoading,+ editingDefinition,+ columnMappingWarnings,+ selectedTableColumns,+ selectedTableColumnsLoading,+ } = useValues(customPropertyDefinitionsLogic)+ const { setCustomPropertyFormValue, loadSelectedTableColumns } = useActions(customPropertyDefinitionsLogic)const hasExistingSource = !!editingDefinition?.sourceconst noTables = !warehouseTablesLoading && warehouseTables.length === 0const mappings = customPropertyForm.columnMappingsconst setMappings = (next: typeof mappings): void => setCustomPropertyFormValue('columnMappings', next)+ const columnOptions = selectedTableColumns.map((column) => ({ key: column, label: column }))// Only block on missing tables while creating a source — an existing source still needs its// key column and enabled switch editable even if its table was later deleted or filtered out.@@ -89,8 +98,18 @@ function PersonSourceEditor(): JSX.Element {{({ value, onChange }) => (<LemonSearchableSelectvalue={value}- onChange={onChange}- options={warehouseTables.map((table) => ({ value: table.id, label: table.name }))}+ onChange={(newValue) => {+ onChange(newValue)+ // Columns are table-specific, so a table change invalidates the picks and+ // loads the new table's columns for the pickers below.+ setCustomPropertyFormValue('keyColumn', null)+ setMappings(mappings.map((mapping) => ({ ...mapping, column: '' })))+ loadSelectedTableColumns({ tableId: newValue })+ }}+ options={warehouseTables.map((table) => ({+ value: table.id,+ label: table.hogql_name || table.name,+ }))}loading={warehouseTablesLoading}placeholder="Select a warehouse table"fullWidth@@ -103,7 +122,17 @@ function PersonSourceEditor(): JSX.Element {label="Distinct ID column"help="The column holding each row's distinct ID — used to match the person to update.">- <LemonInput placeholder="e.g. distinct_id" fullWidth />+ {({ value, onChange }) => (+ <LemonInputSelect+ mode="single"+ allowCustomValues+ value={value ? [value] : []}+ onChange={(newValues) => onChange(newValues[0] ?? null)}+ options={columnOptions}+ loading={selectedTableColumnsLoading}+ placeholder="e.g. distinct_id"+ />+ )}</LemonField>{!hasExistingSource && (<div className="flex flex-col gap-2">@@ -114,23 +143,34 @@ function PersonSourceEditor(): JSX.Element {{mappings.map((mapping, index) => (<div key={index} className="flex flex-col gap-1"><div className="flex items-center gap-2">- <LemonInput- value={mapping.column}- onChange={(column) =>- setMappings(mappings.map((m, i) => (i === index ? { ...m, column } : m)))- }- placeholder="Warehouse column"- fullWidth- />+ <div className="flex-1">+ <LemonInputSelect+ mode="single"+ allowCustomValues+ value={mapping.column ? [mapping.column] : []}+ onChange={(newValues) =>+ setMappings(+ mappings.map((m, i) =>+ i === index ? { ...m, column: newValues[0] ?? '' } : m+ )+ )+ }+ options={columnOptions}+ loading={selectedTableColumnsLoading}+ placeholder="Warehouse column"+ />+ </div><span className="text-secondary">→</span>- <LemonInput- value={mapping.property}- onChange={(property) =>- setMappings(mappings.map((m, i) => (i === index ? { ...m, property } : m)))- }- placeholder="Person property"- fullWidth- />+ <div className="flex-1">+ <LemonInput+ value={mapping.property}+ onChange={(property) =>+ setMappings(mappings.map((m, i) => (i === index ? { ...m, property } : m)))+ }+ placeholder="Person property"+ fullWidth+ />+ </div><LemonButtonicon={<IconTrash />}size="small"@@ -276,13 +316,17 @@ export function CustomPropertyModal(): JSX.Element {!customPropertyForm.columnMappings.some((mapping) => mapping.column.trim() && mapping.property.trim())const submitDisabledReason =- customPropertyForm.displayType === 'select' && customPropertyForm.options.length === 0+ // The select-options gate is account-only — the Type field is hidden for person, where a+ // leftover 'select' from switching targets would otherwise wedge the submit button.+ targetType === 'account' &&+ customPropertyForm.displayType === 'select' &&+ customPropertyForm.options.length === 0? 'Add at least one option': missingPersonMapping? 'Map at least one column to a property'- : sourceMode === 'data_warehouse' && noViews+ : targetType === 'account' && sourceMode === 'data_warehouse' && noViews? 'No materialized views are available'- : sourceMode === 'workflow' && editingReferences.length === 0+ : targetType === 'account' && sourceMode === 'workflow' && editingReferences.length === 0? 'Create a workflow that updates this property first': undefined@@ -340,22 +384,28 @@ export function CustomPropertyModal(): JSX.Element {)}</LemonField>)}- <LemonField name="displayType" label="Type">- <LemonSelect options={DISPLAY_TYPE_OPTIONS} fullWidth />- </LemonField>- {showBigNumberSwitch && (- <LemonField name="isBigNumber">- {({ value, onChange }) => (- <LemonSwitch- checked={value}- onChange={onChange}- label="Abbreviate large numbers (e.g. 10,000 → 10K)"- bordered- />+ {/* Type, big-number and options only drive how an account property is rendered — a+ person property is a raw $set value, so these are account-only. */}+ {targetType === 'account' && (+ <>+ <LemonField name="displayType" label="Type">+ <LemonSelect options={DISPLAY_TYPE_OPTIONS} fullWidth />+ </LemonField>+ {showBigNumberSwitch && (+ <LemonField name="isBigNumber">+ {({ value, onChange }) => (+ <LemonSwitch+ checked={value}+ onChange={onChange}+ label="Abbreviate large numbers (e.g. 10,000 → 10K)"+ bordered+ />+ )}+ </LemonField>)}- </LemonField>+ {customPropertyForm.displayType === 'select' && <CustomPropertyOptionsEditor />}+ </>)}- {customPropertyForm.displayType === 'select' && <CustomPropertyOptionsEditor />}{targetType === 'person' && <PersonSourceEditor />}{targetType === 'account' && (<>diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/WarehousePersonPropertiesSetting.tsx b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/WarehousePersonPropertiesSetting.tsxnew file mode 100644index 000000000000..80cb800264d6--- /dev/null+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/WarehousePersonPropertiesSetting.tsx@@ -0,0 +1,150 @@+import { useActions, useValues } from 'kea'++import { IconPencil, IconPlus, IconTrash } from '@posthog/icons'+import { LemonButton, LemonTable, LemonTableColumns, Tooltip } from '@posthog/lemon-ui'++import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedArea'+import { TZLabel } from 'lib/components/TZLabel'+import { TeamMembershipLevel } from 'lib/constants'+import { LemonDialog } from 'lib/lemon-ui/LemonDialog'+import { LemonTag, LemonTagType } from 'lib/lemon-ui/LemonTag'++import type { CustomPropertyDefinitionApi } from 'products/customer_analytics/frontend/generated/api.schemas'++import { customPropertyDefinitionsLogic } from './customPropertyDefinitionsLogic'+import { CustomPropertyModal } from './CustomPropertyModal'+import { type SourceSyncStatusLevel, sourceSyncStatus } from './customPropertyTypes'++const TAG_TYPE_BY_SYNC_LEVEL: Record<SourceSyncStatusLevel, LemonTagType> = {+ synced: 'success',+ error: 'danger',+ disabled: 'muted',+ pending: 'default',+}++// Project-settings view of the warehouse → person property sources: the same definitions managed on+// the Customer analytics accounts page, filtered to person targets and created straight into 'person'.+export function WarehousePersonPropertiesSetting(): JSX.Element {+ const { definitions, definitionsLoading } = useValues(customPropertyDefinitionsLogic)+ const { openCreateModal, openEditModal, deleteDefinition } = useActions(customPropertyDefinitionsLogic)+ const restrictionReason = useRestrictedArea({+ scope: RestrictionScope.Project,+ minimumAccessLevel: TeamMembershipLevel.Admin,+ })++ const personDefinitions = definitions.filter((definition) => definition.target_type === 'person')++ const confirmDelete = (definition: CustomPropertyDefinitionApi): void => {+ LemonDialog.open({+ title: `Delete ${definition.name}?`,+ description: `This stops syncing its warehouse columns onto people. Values already synced stay on the people, but they'll stop updating. This can't be undone.`,+ primaryButton: {+ children: 'Delete',+ status: 'danger',+ onClick: () => deleteDefinition({ id: definition.id }),+ },+ secondaryButton: { children: 'Cancel' },+ })+ }++ const columns: LemonTableColumns<CustomPropertyDefinitionApi> = [+ {+ title: 'Name',+ dataIndex: 'name',+ render: (_, definition) => <span className="font-semibold">{definition.name}</span>,+ },+ {+ title: 'Distinct ID column',+ render: (_, definition) =>+ definition.source?.key_column ? (+ <code>{definition.source.key_column}</code>+ ) : (+ <span className="text-secondary">—</span>+ ),+ },+ {+ title: 'Mapped properties',+ render: (_, definition) => {+ const map = (definition.source?.column_property_map ?? {}) as Record<string, string>+ const entries = Object.entries(map)+ if (!entries.length) {+ return <span className="text-secondary">—</span>+ }+ return (+ <div className="flex flex-wrap gap-1">+ {entries.map(([column, property]) => (+ <LemonTag key={column} type="option">+ {column} → {property}+ </LemonTag>+ ))}+ </div>+ )+ },+ },+ {+ title: 'Sync',+ render: (_, definition) => {+ if (!definition.source) {+ return <span className="text-secondary">—</span>+ }+ const status = sourceSyncStatus(definition.source)+ return (+ <Tooltip title={status.tooltip}>+ <span className="flex items-center gap-2">+ <LemonTag type={TAG_TYPE_BY_SYNC_LEVEL[status.level]}>{status.label}</LemonTag>+ {status.level === 'synced' && definition.source.last_synced_at && (+ <TZLabel time={definition.source.last_synced_at} className="text-secondary" />+ )}+ </span>+ </Tooltip>+ )+ },+ },+ {+ title: '',+ width: 0,+ render: (_, definition) => (+ <div className="flex gap-1 justify-end">+ <LemonButton+ size="small"+ icon={<IconPencil />}+ tooltip="Edit"+ onClick={() => openEditModal(definition)}+ disabledReason={restrictionReason}+ />+ <LemonButton+ size="small"+ status="danger"+ icon={<IconTrash />}+ tooltip="Delete"+ onClick={() => confirmDelete(definition)}+ disabledReason={restrictionReason}+ />+ </div>+ ),+ },+ ]++ return (+ <div className="flex flex-col gap-2">+ <div className="flex justify-end">+ <LemonButton+ type="primary"+ icon={<IconPlus />}+ onClick={() => openCreateModal('person')}+ disabledReason={restrictionReason}+ >+ Add person property+ </LemonButton>+ </div>+ <LemonTable+ columns={columns}+ dataSource={personDefinitions}+ loading={definitionsLoading}+ rowKey="id"+ emptyState="No warehouse-backed person properties yet. Add one to sync warehouse columns onto people."+ />+ <CustomPropertyModal />+ </div>+ )+}diff --git a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.ts b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.tsindex c12c54855e41..8b82c70dcc51 100644--- a/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.ts+++ b/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/account/customPropertyDefinitionsLogic.ts@@ -89,25 +89,30 @@ const serializeDefinition = ({target_type: CustomPropertyTargetTypeis_big_number: booleanoptions?: CustomPropertyOptionApi[]-} => ({- name: name.trim(),- description: description?.trim() || null,- display_type: displayType,- // Create-only on the backend; a definition's target doesn't change after creation.- target_type: targetType,- // The switch is hidden for non-numeric types, so never send a stale flag for them.- is_big_number: isNumericDisplayType(displayType) ? isBigNumber : false,- // Options only apply to select; the backend clears them for other types.- ...(displayType === 'select'- ? {- options: options.map(({ id, label, color }) => ({- ...(id && !id.startsWith(NEW_OPTION_ID_PREFIX) ? { id } : {}),- label: label.trim(),- color,- })),- }- : {}),-})+} => {+ // display_type/is_big_number/options only drive how an account property renders — a person+ // property is written as a raw $set value, so those fields are hidden and forced to defaults.+ const isPerson = targetType === 'person'+ return {+ name: name.trim(),+ description: description?.trim() || null,+ display_type: isPerson ? 'text' : displayType,+ // Create-only on the backend; a definition's target doesn't change after creation.+ target_type: targetType,+ // The switch is hidden for non-numeric types, so never send a stale flag for them.+ is_big_number: !isPerson && isNumericDisplayType(displayType) ? isBigNumber : false,+ // Options only apply to select; the backend clears them for other types.+ ...(!isPerson && displayType === 'select'+ ? {+ options: options.map(({ id, label, color }) => ({+ ...(id && !id.startsWith(NEW_OPTION_ID_PREFIX) ? { id } : {}),+ label: label.trim(),+ color,+ })),+ }+ : {}),+ }+}// Identity-critical person properties a warehouse source shouldn't silently overwrite. `$`-prefixed// props are also warned on (see columnMappingWarnings). Warn-only — the user can still proceed.@@ -163,6 +168,8 @@ export interface customPropertyDefinitionsLogicValues {savedQueries: DataWarehouseSavedQuery[]savedQueriesLoading: booleanselectedSourceColumns: string[]+ selectedTableColumns: string[]+ selectedTableColumnsLoading: booleanselectedWarehouseSchemaId: string | nullserializedColumnPropertyMap: Record<string, string>showCustomPropertyFormErrors: boolean@@ -256,6 +263,27 @@ export interface customPropertyDefinitionsLogicActions {savedQueries: DataWarehouseSavedQuery[]payload?: any}+ loadSelectedTableColumns: ({ tableId }: { tableId: string | null }) => {+ tableId: string | null+ }+ loadSelectedTableColumnsFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadSelectedTableColumnsSuccess: (+ selectedTableColumns: string[],+ payload?: {+ tableId: string | null+ }+ ) => {+ selectedTableColumns: string[]+ payload?: {+ tableId: string | null+ }+ }loadWarehouseTables: () => anyloadWarehouseTablesFailure: (error: string,@@ -271,8 +299,8 @@ export interface customPropertyDefinitionsLogicActions {warehouseTables: DataWarehouseTable[]payload?: any}- openCreateModal: () => {- value: true+ openCreateModal: (targetType?: CustomPropertyTargetType) => {+ targetType: CustomPropertyTargetType | undefined}openEditModal: (definition: CustomPropertyDefinitionApi) => {definition: CustomPropertyDefinitionApi@@ -362,7 +390,9 @@ export const customPropertyDefinitionsLogic = kea<customPropertyDefinitionsLogicvalues: [projectLogic, ['currentProjectId']],})),actions({- openCreateModal: true,+ // An optional target pre-selects Account/Person (the person-properties settings entry opens+ // straight into 'person'); omitted, it falls back to the account default.+ openCreateModal: (targetType?: CustomPropertyTargetType) => ({ targetType }),openEditModal: (definition: CustomPropertyDefinitionApi) => ({ definition }),closeModal: true,setEditingDefinition: (definition: CustomPropertyDefinitionApi) => ({ definition }),@@ -413,12 +443,26 @@ export const customPropertyDefinitionsLogic = kea<customPropertyDefinitionsLogic[] as DataWarehouseTable[],{loadWarehouseTables: async (): Promise<DataWarehouseTable[]> => {- const response = await api.dataWarehouseTables.list()+ // Skip column serialization (expensive per-table HogQL work) and raise the limit off the+ // default 100 — the picker only needs names, and columns load per-table on selection.+ const response = await api.dataWarehouseTables.list({ include_columns: false, limit: 1000 })// Only synced tables carry an external_schema, which is what a person source binds to.return response.results.filter((table) => !!table.external_schema)},},],+ selectedTableColumns: [+ [] as string[],+ {+ loadSelectedTableColumns: async ({ tableId }: { tableId: string | null }): Promise<string[]> => {+ if (!tableId) {+ return []+ }+ const table = await api.dataWarehouseTables.get(tableId)+ return (table.columns ?? []).map((column) => column.name)+ },+ },+ ],personPropertyDefinitions: [[] as PropertyDefinition[],{@@ -618,12 +662,17 @@ export const customPropertyDefinitionsLogic = kea<customPropertyDefinitionsLogic},],}),- listeners(({ actions }) => ({- openCreateModal: () => {+ listeners(({ actions, values }) => ({+ openCreateModal: ({ targetType }) => {actions.resetCustomPropertyForm()+ if (targetType) {+ actions.setCustomPropertyFormValue('targetType', targetType)+ }actions.loadSavedQueries()actions.loadWarehouseTables()actions.loadPersonPropertyDefinitions()+ // No table picked yet — clear any columns left over from a previous open.+ actions.loadSelectedTableColumnsSuccess([])},openEditModal: ({ definition }) => {actions.loadSavedQueries()@@ -654,6 +703,20 @@ export const customPropertyDefinitionsLogic = kea<customPropertyDefinitionsLogicisEnabled: definition.source?.is_enabled ?? true,})},+ loadWarehouseTablesSuccess: () => {+ // On edit the table binding is create-only and hidden, but the distinct-ID column stays+ // editable — so resolve the bound table from the source's schema and load its columns to+ // drive that picker. Resolving here (not in openEditModal) waits for the table list to load.+ const source = values.editingDefinition?.source+ if (source?.external_data_schema) {+ const table = values.warehouseTables.find(+ (candidate) => candidate.external_schema?.id === source.external_data_schema+ )+ if (table) {+ actions.loadSelectedTableColumns({ tableId: table.id })+ }+ }+ },submitCustomPropertyFormSuccess: () => {lemonToast.success('Custom property saved')actions.loadDefinitions()diff --git a/products/data_warehouse/backend/presentation/views/table.py b/products/data_warehouse/backend/presentation/views/table.pyindex c2e529e56965..51c17f4d519c 100644--- a/products/data_warehouse/backend/presentation/views/table.py+++ b/products/data_warehouse/backend/presentation/views/table.py@@ -55,6 +55,11 @@ class TableSerializer(UserAccessControlSerializerMixin, serializers.ModelSerialicreated_by = UserBasicSerializer(read_only=True)credential = CredentialSerializer()columns = serializers.SerializerMethodField(read_only=True)+ hogql_name = serializers.SerializerMethodField(+ read_only=True,+ help_text="Dotted name the table is queried by in HogQL (e.g. `googleanalytics.devices` or "+ "`postgres.<prefix>.<table>`), as opposed to `name`, which is the underlying storage identifier.",+ )external_data_source = SimpleExternalDataSourceSerializers(read_only=True)external_schema = serializers.SerializerMethodField(read_only=True)options = serializers.DictField(required=False, default=dict)@@ -65,6 +70,7 @@ class TableSerializer(UserAccessControlSerializerMixin, serializers.ModelSeriali"id","deleted","name",+ "hogql_name","format","created_by","created_at",@@ -80,14 +86,23 @@ class TableSerializer(UserAccessControlSerializerMixin, serializers.ModelSeriali"id","created_by","created_at",+ "hogql_name","columns","external_data_source","external_schema","user_access_level",]+ @extend_schema_field(serializers.CharField())+ def get_hogql_name(self, table: DataWarehouseTable) -> str:+ return get_data_warehouse_table_name(table.external_data_source, table.name)+@extend_schema_field(serializers.ListField(child=serializers.DictField()))def get_columns(self, table: DataWarehouseTable) -> list[SerializedField]:+ # Callers that only need the table list (e.g. a table picker) skip the expensive HogQL field+ # serialization by passing include_columns=false — it serializes columns for every row.+ if not self.context.get("include_columns", True):+ return []database = self.context.get("database", None)if not database:database = Database.create_for(@@ -267,7 +282,12 @@ class TableViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, viewsets.Mdef get_serializer_context(self) -> dict[str, Any]:context = super().get_serializer_context()- context["database"] = Database.create_for(team_id=self.team_id, user=cast(User, self.request.user))+ # Building the HogQL database is only needed to serialize columns; a caller that opts out+ # (a picker that just needs table names) skips both the columns and the database build.+ include_columns = self.request.query_params.get("include_columns", "true").lower() != "false"+ context["include_columns"] = include_columns+ if include_columns:+ context["database"] = Database.create_for(team_id=self.team_id, user=cast(User, self.request.user))context["team_id"] = self.team_idreturn contextdiff --git a/products/data_warehouse/backend/tests/api/test_table.py b/products/data_warehouse/backend/tests/api/test_table.pyindex cfb0ed1eeca8..6ae130b8990a 100644--- a/products/data_warehouse/backend/tests/api/test_table.py+++ b/products/data_warehouse/backend/tests/api/test_table.py@@ -550,6 +550,36 @@ class TestTable(APIBaseTest):assert response.json()["count"] == 1assert response.json()["results"][0]["id"] == str(table.id)+ def test_list_tables_exposes_hogql_name_and_honors_include_columns(self):+ source = ExternalDataSource.objects.create(+ team=self.team,+ team_id=self.team.pk,+ source_type="GoogleAnalytics",+ prefix="",+ access_method=ExternalDataSource.AccessMethod.WAREHOUSE,+ )+ DataWarehouseTable.objects.create(+ name="googleanalytics_devices",+ format="Parquet",+ team=self.team,+ team_id=self.team.pk,+ url_pattern="https://example.com/devices.parquet",+ external_data_source_id=source.pk,+ columns={"id": {"clickhouse": "Int32", "hogql": "integer", "valid": True}},+ )++ default = self.client.get(f"/api/projects/{self.team.pk}/warehouse_tables/").json()["results"][0]+ # The picker labels by the dotted HogQL name, not the raw storage identifier.+ assert default["hogql_name"] == "googleanalytics.devices"+ assert "id" in [column["name"] for column in default["columns"]]++ # A picker that only needs names opts out of the expensive per-table column serialization.+ skipped = self.client.get(f"/api/projects/{self.team.pk}/warehouse_tables/?include_columns=false").json()[+ "results"+ ][0]+ assert skipped["hogql_name"] == "googleanalytics.devices"+ assert skipped["columns"] == []+def test_create_table_with_internal_bucket_url(self):with override_settings(DATAWAREHOUSE_BUCKET_DOMAIN="somedomain.com"):response = self.client.post(diff --git a/products/data_warehouse/frontend/generated/api.schemas.ts b/products/data_warehouse/frontend/generated/api.schemas.tsindex db4e660736ce..66451d5bfa8a 100644--- a/products/data_warehouse/frontend/generated/api.schemas.ts+++ b/products/data_warehouse/frontend/generated/api.schemas.ts@@ -3010,6 +3010,8 @@ export interface TableApi {deleted?: boolean | null/** @maxLength 128 */name: string+ /** Dotted name the table is queried by in HogQL (e.g. `googleanalytics.devices` or `postgres.<prefix>.<table>`), as opposed to `name`, which is the underlying storage identifier. */+ readonly hogql_name: stringformat: TableFormatEnumApireadonly created_by: UserBasicApireadonly created_at: string@@ -3055,6 +3057,8 @@ export interface PatchedTableApi {deleted?: boolean | null/** @maxLength 128 */name?: string+ /** Dotted name the table is queried by in HogQL (e.g. `googleanalytics.devices` or `postgres.<prefix>.<table>`), as opposed to `name`, which is the underlying storage identifier. */+ readonly hogql_name?: stringformat?: TableFormatEnumApireadonly created_by?: UserBasicApireadonly created_at?: stringdiff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 7ec6d936eb70..ce2a3df192d3 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -41541,6 +41541,8 @@ export namespace Schemas {deleted?: boolean | null;/** @maxLength 128 */name: string;+ /** Dotted name the table is queried by in HogQL (e.g. `googleanalytics.devices` or `postgres.<prefix>.<table>`), as opposed to `name`, which is the underlying storage identifier. */+ readonly hogql_name: string;format: TableFormatEnum;readonly created_by: UserBasic;readonly created_at: string;@@ -49505,6 +49507,8 @@ export namespace Schemas {deleted?: boolean | null;/** @maxLength 128 */name?: string;+ /** Dotted name the table is queried by in HogQL (e.g. `googleanalytics.devices` or `postgres.<prefix>.<table>`), as opposed to `name`, which is the underlying storage identifier. */+ readonly hogql_name?: string;format?: TableFormatEnum;readonly created_by?: UserBasic;readonly created_at?: string;