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): clearer warehouse name hint and provisioning time (#64865)

Benjamin Knofe-Viderf4878ce01d96
diff --git a/frontend/src/scenes/data-warehouse/scene/SettingsTab.tsx b/frontend/src/scenes/data-warehouse/scene/SettingsTab.tsx
index ec208f406f46..916303bf6bac 100644
--- a/frontend/src/scenes/data-warehouse/scene/SettingsTab.tsx
+++ b/frontend/src/scenes/data-warehouse/scene/SettingsTab.tsx
@@ -99,6 +99,7 @@ export function SettingsTab(): JSX.Element {
retryDatabaseName,
initialPassword,
isResettingPassword,
+ warehouseDomain,
} = useValues(warehouseProvisioningLogic)
const { provisionWarehouse, deprovisionWarehouse, setDatabaseName, clearInitialPassword, resetPassword } =
useActions(warehouseProvisioningLogic)
@@ -181,14 +182,26 @@ export function SettingsTab(): JSX.Element {
and ending with a letter or number.
</p>
)}
- {(!databaseName ||
- (isValidDatabaseName && (databaseNameChecking || databaseNameAvailable === true))) && (
+ {databaseName &&
+ isValidDatabaseName &&
+ !databaseNameChecking &&
+ databaseNameAvailable === true &&
+ warehouseDomain ? (
+ <p className="text-muted text-xs mt-1">
+ Your warehouse will be available at{' '}
+ <code>
+ {databaseName}.dw.{warehouseDomain}
+ </code>
+ . You always connect with <code>dbname=ducklake</code>.
+ </p>
+ ) : !databaseName ||
+ (isValidDatabaseName && (databaseNameChecking || databaseNameAvailable === true)) ? (
<p className="text-muted text-xs mt-1">
Unique name for your warehouse. It becomes the subdomain of your connection host (e.g.{' '}
- <code>my-warehouse.dw.us.postwh.com</code>). You always connect with{' '}
- <code>dbname=ducklake</code>.
+ <code>my-warehouse.dw.{warehouseDomain ?? 'us.postwh.com'}</code>). You always connect
+ with <code>dbname=ducklake</code>.
</p>
- )}
+ ) : null}
</div>
<LemonButton
type="primary"
@@ -208,7 +221,7 @@ export function SettingsTab(): JSX.Element {
? 'Retry managed warehouse provisioning?'
: 'Provision managed warehouse?',
description:
- 'This will create a managed warehouse for your organization, shared by every project in it. This typically takes 5-15 minutes.',
+ 'This will create a managed warehouse for your organization, shared by every project in it. Should take less than 5 minutes.',
primaryButton: {
children: isFailed ? 'Retry provisioning' : 'Provision',
onClick: () => provisionWarehouse({ databaseName: retryDatabaseName }),
diff --git a/frontend/src/scenes/data-warehouse/scene/warehouseProvisioningLogic.ts b/frontend/src/scenes/data-warehouse/scene/warehouseProvisioningLogic.ts
index 4fdcd7e038b7..4c31df39a9e3 100644
--- a/frontend/src/scenes/data-warehouse/scene/warehouseProvisioningLogic.ts
+++ b/frontend/src/scenes/data-warehouse/scene/warehouseProvisioningLogic.ts
@@ -1,9 +1,12 @@
-import { actions, afterMount, kea, listeners, path, reducers, selectors } from 'kea'
+import { actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
+import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { teamLogic } from 'scenes/teamLogic'
+import { Region } from '~/types'
+
import {
dataWarehouseCheckDatabaseNameRetrieve,
dataWarehouseDeprovisionCreate,
@@ -20,6 +23,14 @@ import type { warehouseProvisioningLogicType } from './warehouseProvisioningLogi
// 3-63 chars, lowercase alphanumerics and hyphens, starting/ending alphanumeric (no underscores).
const WAREHOUSE_NAME_REGEX = /^[a-z][a-z0-9-]{1,61}[a-z0-9]$/
+// DNS zone the connection host lives under, selected by deployment region. Mirrors
+// _MANAGED_WAREHOUSE_DOMAINS in products/data_warehouse/backend/api/managed_warehouse.py.
+const MANAGED_WAREHOUSE_DOMAINS: Partial<Record<Region, string>> = {
+ [Region.US]: 'us.postwh.com',
+ [Region.EU]: 'eu.postwh.com',
+ [Region.DEV]: 'dev.postwh.com',
+}
+
const databaseNameStorageKey = (teamId: number | null): string =>
`warehouse-provisioning-database-name-${teamId ?? 'unknown'}`
@@ -28,6 +39,10 @@ const currentProjectId = (): string => String(teamLogic.values.currentTeamId)
export const warehouseProvisioningLogic = kea<warehouseProvisioningLogicType>([
path(['scenes', 'data-warehouse', 'scene', 'warehouseProvisioningLogic']),
+ connect(() => ({
+ values: [preflightLogic, ['preflight']],
+ })),
+
actions({
provisionWarehouse: (params: { databaseName: string }) => params,
provisionWarehouseComplete: true,
@@ -151,6 +166,14 @@ export const warehouseProvisioningLogic = kea<warehouseProvisioningLogicType>([
},
],
isValidDatabaseName: [(s) => [s.databaseName], (name): boolean => WAREHOUSE_NAME_REGEX.test(name)],
+ // DNS zone for the connection host, resolved from the deployment region (null when unknown).
+ warehouseDomain: [
+ (s) => [s.preflight],
+ (preflight): string | null => {
+ const region = preflight?.region
+ return region ? (MANAGED_WAREHOUSE_DOMAINS[region] ?? null) : null
+ },
+ ],
retryDatabaseName: [
(s) => [s.databaseName, s.lastRequestedDatabaseName],
(databaseName, lastRequestedDatabaseName): string => databaseName || lastRequestedDatabaseName || '',