Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

add support for warehouse connection string (#49914)

Coenen Benjamin11289328e5f4
diff --git a/apps/studio/components/interfaces/ConnectSheet/Connect.types.ts b/apps/studio/components/interfaces/ConnectSheet/Connect.types.ts
index 2c863fdabb8..fc5bf7712ec 100644
--- a/apps/studio/components/interfaces/ConnectSheet/Connect.types.ts
+++ b/apps/studio/components/interfaces/ConnectSheet/Connect.types.ts
@@ -57,7 +57,7 @@ export type ConditionalValue<T> =
// Schema Types - Modes
// ============================================================================
-export const CONNECT_MODES = ['framework', 'direct', 'orm', 'mcp', 'server'] as const
+export const CONNECT_MODES = ['framework', 'direct', 'orm', 'mcp', 'server', 'warehouse'] as const
export type ConnectMode = (typeof CONNECT_MODES)[number]
export interface ModeDefinition {
diff --git a/apps/studio/components/interfaces/ConnectSheet/ConnectModeButton.tsx b/apps/studio/components/interfaces/ConnectSheet/ConnectModeButton.tsx
index 2d891eacbc1..83d117a1043 100644
--- a/apps/studio/components/interfaces/ConnectSheet/ConnectModeButton.tsx
+++ b/apps/studio/components/interfaces/ConnectSheet/ConnectModeButton.tsx
@@ -1,5 +1,5 @@
import { cva, type VariantProps } from 'class-variance-authority'
-import { Box, Cable, Database, Server, Sparkles } from 'lucide-react'
+import { Box, Cable, Database, Server, Sparkles, Warehouse } from 'lucide-react'
import type { ComponentPropsWithoutRef, ReactNode } from 'react'
import { cn } from 'ui'
@@ -11,6 +11,7 @@ const MODE_ICONS: Record<string, ReactNode> = {
orm: <Cable size={16} strokeWidth={1.5} />,
mcp: <Sparkles size={16} strokeWidth={1.5} />,
server: <Server size={16} strokeWidth={1.5} />,
+ warehouse: <Warehouse size={16} strokeWidth={1.5} />,
}
/** Maps mode count → container-query breakpoint used when collapsing to a single row. */
diff --git a/apps/studio/components/interfaces/ConnectSheet/ConnectSheet.tsx b/apps/studio/components/interfaces/ConnectSheet/ConnectSheet.tsx
index a6684e24f0a..33eaf0e619f 100644
--- a/apps/studio/components/interfaces/ConnectSheet/ConnectSheet.tsx
+++ b/apps/studio/components/interfaces/ConnectSheet/ConnectSheet.tsx
@@ -12,6 +12,7 @@ import { useAvailableConnectModes } from './useAvailableConnectModes'
import { useConnectSheetParams } from './useConnectSheetParams'
import { useConnectSheetShortcut } from './useConnectSheetShortcut'
import { useConnectState } from './useConnectState'
+import { WarehouseModePanel } from './WarehouseModePanel/WarehouseModePanel'
import { useAPIKeys } from '@/data/api-keys/api-keys-query'
import { useProjectApiUrl } from '@/data/config/project-endpoint-query'
import { useAsyncCheckPermissions } from '@/hooks/misc/useCheckPermissions'
@@ -177,18 +178,26 @@ export const ConnectSheet = () => {
/>
</div>
- {activeFields.length > 0 && (
+ {state.mode === 'warehouse' ? (
<div className="p-8">
- <ConnectConfigSection
- state={state}
- activeFields={activeFields}
- onFieldChange={handleFieldChange}
- getFieldOptions={getFieldOptions}
- />
+ <WarehouseModePanel />
</div>
+ ) : (
+ <>
+ {activeFields.length > 0 && (
+ <div className="p-8">
+ <ConnectConfigSection
+ state={state}
+ activeFields={activeFields}
+ onFieldChange={handleFieldChange}
+ getFieldOptions={getFieldOptions}
+ />
+ </div>
+ )}
+
+ <ConnectStepsSection steps={resolvedSteps} state={state} projectKeys={projectKeys} />
+ </>
)}
-
- <ConnectStepsSection steps={resolvedSteps} state={state} projectKeys={projectKeys} />
</div>
</SheetContent>
</Sheet>
diff --git a/apps/studio/components/interfaces/ConnectSheet/WarehouseModePanel/WarehouseConnectionDetails.tsx b/apps/studio/components/interfaces/ConnectSheet/WarehouseModePanel/WarehouseConnectionDetails.tsx
new file mode 100644
index 00000000000..b17e2ecddb3
--- /dev/null
+++ b/apps/studio/components/interfaces/ConnectSheet/WarehouseModePanel/WarehouseConnectionDetails.tsx
@@ -0,0 +1,211 @@
+import { useParams } from 'common'
+import { KeyRound } from 'lucide-react'
+import Link from 'next/link'
+import { Badge, Button } from 'ui'
+import { Admonition } from 'ui-patterns/Admonition'
+import { CodeBlock } from 'ui-patterns/CodeBlock'
+import { Input } from 'ui-patterns/DataInputs/Input'
+import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'
+
+import type { WarehouseCatalogCredentials } from './WarehouseModePanel.utils'
+import { AlertError } from '@/components/ui/AlertError'
+import { useUpdateWarehouseCatalogMutation } from '@/data/warehouse/warehouse-catalog-mutation'
+import { useWarehouseCatalogQuery } from '@/data/warehouse/warehouse-catalog-query'
+import {
+ DUCKLAKE_METADATA_PASSWORD_ENV_VAR,
+ DUCKLAKE_S3_SECRET_ENV_VAR,
+ getDuckLakeSetupScript,
+ getWarehouseFlightSqlConnectionString,
+ getWarehouseFlightSqlEndpoint,
+ getWarehouseUsqlCommand,
+ parseWarehouseCatalogUrl,
+} from '@/lib/warehouse'
+
+export interface WarehouseConnectionDetailsProps {
+ onEditTables: () => void
+}
+
+function FieldRow({ label, children }: { label: React.ReactNode; children: React.ReactNode }) {
+ return (
+ // `minmax(0,1fr)` rather than `1fr`: a 1fr track keeps `min-width: auto`, so a long
+ // single-line value (the FlightSQL connection string) stretches the track past the panel
+ // instead of truncating inside it.
+ <div className="grid grid-cols-[180px_minmax(0,1fr)] gap-4 items-center">
+ <span className="text-sm text-foreground-light">{label}</span>
+ <div className="min-w-0">{children}</div>
+ </div>
+ )
+}
+
+/**
+ * The DuckDB setup script inlines everything except the two passwords, which it reads via
+ * `getenv()` — so those are the only credential values surfaced as their own rows here.
+ */
+function DuckLakeSetup({ credentials }: { credentials: WarehouseCatalogCredentials }) {
+ const connection = parseWarehouseCatalogUrl(credentials.catalog_url)
+
+ if (connection === null) {
+ return (
+ <div className="flex flex-col gap-3 mt-2">
+ <Admonition
+ type="warning"
+ title="Could not read the catalog connection details"
+ description="Copy the catalog URL and configure the DuckLake secrets manually."
+ />
+ <FieldRow label="Catalog URL">
+ <Input readOnly copy reveal className="font-mono" value={credentials.catalog_url} />
+ </FieldRow>
+ </div>
+ )
+ }
+
+ const setupScript = getDuckLakeSetupScript({ credentials, connection })
+
+ return (
+ <div className="flex flex-col gap-3 mt-2">
+ <p className="text-sm text-foreground-light max-w-xl mb-1">
+ Attach this project's Warehouse directly from DuckDB. The script reads both passwords from
+ environment variables — set these before running it:
+ </p>
+ <FieldRow label={<span className="font-mono text-xs">{DUCKLAKE_S3_SECRET_ENV_VAR}</span>}>
+ <Input
+ readOnly
+ copy
+ reveal
+ className="font-mono"
+ value={credentials.s3_secret_access_key}
+ />
+ </FieldRow>
+ <FieldRow
+ label={<span className="font-mono text-xs">{DUCKLAKE_METADATA_PASSWORD_ENV_VAR}</span>}
+ >
+ <Input readOnly copy reveal className="font-mono" value={connection.password} />
+ </FieldRow>
+ {/*
+ `className` is what switches CodeBlock from its plain <code> fallback to the syntax
+ highlighter — without it the SQL renders unhighlighted and the blank lines between steps
+ collapse.
+ */}
+ <CodeBlock
+ className="[&_code]:text-foreground"
+ language="sql"
+ hideLineNumbers
+ value={setupScript}
+ />
+ </div>
+ )
+}
+
+export const WarehouseConnectionDetails = ({ onEditTables }: WarehouseConnectionDetailsProps) => {
+ const { ref: projectRef } = useParams()
+
+ const {
+ data: catalog,
+ isPending: isCatalogPending,
+ isError: isCatalogError,
+ error: catalogError,
+ } = useWarehouseCatalogQuery({ projectRef })
+ const catalogMutation = useUpdateWarehouseCatalogMutation()
+
+ if (!projectRef) return null
+
+ const endpoint = getWarehouseFlightSqlEndpoint(projectRef)
+ const connectionString = getWarehouseFlightSqlConnectionString(projectRef)
+ const usqlCommand = getWarehouseUsqlCommand(projectRef)
+
+ return (
+ <div>
+ <div className="flex items-center gap-3 mb-5">
+ <Badge variant="success">Warehouse enabled</Badge>
+ <button
+ type="button"
+ tabIndex={0}
+ onClick={onEditTables}
+ className="text-sm text-foreground-light underline underline-offset-2 ml-auto"
+ >
+ Edit replicated tables
+ </button>
+ </div>
+
+ <h3 className="text-sm font-medium text-foreground mb-3">External access</h3>
+ <div className="flex flex-col gap-3">
+ <FieldRow label="Endpoint">
+ <Input readOnly copy className="font-mono" value={endpoint} />
+ </FieldRow>
+ <FieldRow label="Connection string">
+ <Input readOnly copy className="font-mono" value={connectionString} />
+ </FieldRow>
+ <FieldRow label="User">
+ <Input readOnly copy className="font-mono" value="postgres" />
+ </FieldRow>
+ <FieldRow label="Password">
+ <div className="flex items-center gap-3">
+ <span className="text-sm text-foreground-light">
+ Same password as your primary database.
+ </span>
+ <Button
+ asChild
+ variant="default"
+ size="tiny"
+ icon={<KeyRound size={14} />}
+ className="ml-auto"
+ >
+ <Link href={`/project/${projectRef}/settings/database`}>Reset database password</Link>
+ </Button>
+ </div>
+ </FieldRow>
+ </div>
+
+ <div className="h-px bg-border my-6" />
+
+ <h3 className="text-sm font-medium text-foreground mb-1">Connect with FlightSQL</h3>
+ <p className="text-sm text-foreground-light max-w-xl mb-3">
+ Warehouse speaks the Arrow FlightSQL protocol. Any FlightSQL-compatible client can connect —
+ for example, using the <span className="font-mono">usql</span> CLI:
+ </p>
+ <CodeBlock
+ className="[&_code]:text-foreground"
+ language="bash"
+ hideLineNumbers
+ wrapLongLines
+ value={usqlCommand}
+ />
+
+ <div className="h-px bg-border my-6" />
+
+ <h3 className="text-sm font-medium text-foreground mb-1">
+ Connect with DuckDB (DuckLake catalog)
+ </h3>
+
+ {isCatalogPending && <GenericSkeletonLoader />}
+
+ {isCatalogError && (
+ <AlertError
+ className="mt-2"
+ subject="Failed to load DuckLake catalog access"
+ error={catalogError}
+ />
+ )}
+
+ {!isCatalogPending && !isCatalogError && !catalog?.enabled && (
+ <div className="flex items-center gap-3 mt-2">
+ <p className="text-sm text-foreground-light max-w-lg">
+ Enable catalog access to attach this project's Warehouse directly from DuckDB.
+ </p>
+ <Button
+ variant="default"
+ className="ml-auto shrink-0"
+ loading={catalogMutation.isPending}
+ onClick={() => catalogMutation.mutate({ projectRef, body: { enabled: true } })}
+ >
+ Enable catalog access
+ </Button>
+ </div>
+ )}
+
+ {!isCatalogPending && !isCatalogError && catalog?.enabled && catalog.credentials && (
+ <DuckLakeSetup credentials={catalog.credentials} />
+ )}
+ </div>
+ )
+}
diff --git a/apps/studio/components/interfaces/ConnectSheet/WarehouseModePanel/WarehouseEnablingProgress.tsx b/apps/studio/components/interfaces/ConnectSheet/WarehouseModePanel/WarehouseEnablingProgress.tsx
new file mode 100644
index 00000000000..5953901316c
--- /dev/null
+++ b/apps/studio/components/interfaces/ConnectSheet/WarehouseModePanel/WarehouseEnablingProgress.tsx
@@ -0,0 +1,55 @@
+import { Loader2 } from 'lucide-react'
+import { Badge } from 'ui'
+import { Admonition } from 'ui-patterns/Admonition'
+
+import type { WarehouseSetupStatusResponse } from '@/data/warehouse/warehouse-setup-status-query'
+
+const TABLE_STATE_BADGE: Record<
+ WarehouseSetupStatusResponse['tables'][number]['state'],
+ { label: string; variant: 'warning' | 'success' | 'destructive' }
+> = {
+ syncing: { label: 'Backfilling', variant: 'warning' },
+ live: { label: 'Synced', variant: 'success' },
+ error: { label: 'Error', variant: 'destructive' },
+}
+
+export interface WarehouseEnablingProgressProps {
+ status: WarehouseSetupStatusResponse
+}
+
+export const WarehouseEnablingProgress = ({ status }: WarehouseEnablingProgressProps) => {
+ return (
+ <div>
+ <Admonition
+ type="default"
+ icon={
+ <Loader2 size={16} strokeWidth={1.5} className="animate-spin text-foreground-light" />
+ }
+ description="Setting up your Warehouse — this can take a few minutes while we backfill selected tables."
+ className="mb-5"
+ />
+
+ <div className="border rounded-md overflow-hidden divide-y">
+ {status.tables.map((table) => {
+ const badge = TABLE_STATE_BADGE[table.state]
+ return (
+ <div
+ key={`${table.schema}.${table.name}`}
+ className="flex items-center gap-2 px-3 py-2.5"
+ >
+ <span className="text-sm font-mono text-foreground flex-1">
+ {table.schema}.{table.name}
+ </span>
+ <Badge variant={badge.variant}>{badge.label}</Badge>
+ </div>
+ )
+ })}
+ {status.tables.length === 0 && (
+ <p className="px-3 py-2.5 text-sm text-foreground-lighter">
+ No tables are being copied yet.
+ </p>
+ )}
+ </div>
+ </div>
+ )
+}
diff --git a/apps/studio/components/interfaces/ConnectSheet/WarehouseModePanel/WarehouseModePanel.tsx b/apps/studio/components/interfaces/ConnectSheet/WarehouseModePanel/WarehouseModePanel.tsx
new file mode 100644
index 00000000000..25c3eab8f4b
--- /dev/null
+++ b/apps/studio/components/interfaces/ConnectSheet/WarehouseModePanel/WarehouseModePanel.tsx
@@ -0,0 +1,123 @@
+import { useParams } from 'common'
+import { useState } from 'react'
+import { toast } from 'sonner'
+import { Button } from 'ui'
+import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'
+
+import { WarehouseConnectionDetails } from './WarehouseConnectionDetails'
+import { WarehouseEnablingProgress } from './WarehouseEnablingProgress'
+import type { WarehouseSetupTarget } from './WarehouseModePanel.utils'
+import { WarehouseSchemaTablePicker } from './WarehouseSchemaTablePicker'
+import { AlertError } from '@/components/ui/AlertError'
+import { useUpdateWarehouseCatalogMutation } from '@/data/warehouse/warehouse-catalog-mutation'
+import { useWarehouseSetupMutation } from '@/data/warehouse/warehouse-setup-mutation'
+import { useWarehouseSetupStatusQuery } from '@/data/warehouse/warehouse-setup-status-query'
+
+const POLLING_SETUP_STATUSES = new Set(['setting_up', 'copying'])
+
+interface WarehouseSetupCompleteProps {
+ onSubmit: (targets: WarehouseSetupTarget[]) => void
+ isSubmitting: boolean
+}
+
+const WarehouseSetupComplete = ({ onSubmit, isSubmitting }: WarehouseSetupCompleteProps) => {
+ const [isEditingTables, setIsEditingTables] = useState(false)
+
+ if (isEditingTables) {
+ return (
+ <WarehouseSchemaTablePicker
+ onSubmit={onSubmit}
+ isSubmitting={isSubmitting}
+ onBack={() => setIsEditingTables(false)}
+ />
+ )
+ }
+
+ return <WarehouseConnectionDetails onEditTables={() => setIsEditingTables(true)} />
+}
+
+export const WarehouseModePanel = () => {
+ const { ref: projectRef } = useParams()
+
+ const { data, isPending, isError, error } = useWarehouseSetupStatusQuery(
+ { projectRef },
+ {
+ refetchInterval: (query) => {
+ const status = query.state.data?.setup_status
+ return status && POLLING_SETUP_STATUSES.has(status) ? 3000 : false
+ },
+ }
+ )
+
+ const catalogMutation = useUpdateWarehouseCatalogMutation({
+ onError: (error) => {
+ toast.error(
+ `Warehouse was enabled, but DuckLake catalog access could not be enabled automatically: ${error.message}. You can retry this from the connection details.`
+ )
+ },
+ })
+ const setupMutation = useWarehouseSetupMutation()
+
+ const handleSetup = (targets: WarehouseSetupTarget[]) => {
+ if (!projectRef || targets.length === 0) return
+
+ setupMutation.mutate(
+ { projectRef, body: { targets } },
+ {
+ onSuccess: () => {
+ // Fire-and-forget: setup itself should proceed even if enabling catalog access fails.
+ // The connection details panel offers a manual "Enable catalog access" fallback.
+ catalogMutation.mutate({ projectRef, body: { enabled: true } })
+ },
+ }
+ )
+ }
+
+ if (isPending) return <GenericSkeletonLoader />
+ if (isError) return <AlertError subject="Failed to load Warehouse status" error={error} />
+ if (!data) return <GenericSkeletonLoader />
+
+ const status = data.setup_status
+
+ if (status === 'not_started') {
+ return (
+ <WarehouseSchemaTablePicker onSubmit={handleSetup} isSubmitting={setupMutation.isPending} />
+ )
+ }
+
+ if (status === 'setting_up' || status === 'copying') {
+ return <WarehouseEnablingProgress status={data} />
+ }
+
+ if (status === 'error') {
+ const retryTargets: WarehouseSetupTarget[] = (data.tables ?? []).map((table) => ({
+ type: 'table' as const,
+ schema: table.schema,
+ name: table.name,
+ }))
+ const failingStep = data.steps.find((step) => step.status === 'error')
+
+ return (
+ <AlertError
+ subject="Warehouse setup failed"
+ error={{
+ message: failingStep?.message ?? 'An unknown error occurred while setting up Warehouse.',
+ }}
+ additionalActions={
+ retryTargets.length > 0 ? (
+ <Button
+ variant="default"
+ loading={setupMutation.isPending}
+ onClick={() => handleSetup(retryTargets)}
+ >
+ Retry
+ </Button>
+ ) : undefined
+ }
+ />
+ )
+ }
+
+ // status === 'complete'
+ return <WarehouseSetupComplete onSubmit={handleSetup} isSubmitting={setupMutation.isPending} />
+}
diff --git a/apps/studio/components/interfaces/ConnectSheet/WarehouseModePanel/WarehouseModePanel.utils.ts b/apps/studio/components/interfaces/ConnectSheet/WarehouseModePanel/WarehouseModePanel.utils.ts
new file mode 100644
index 00000000000..0b633958e4c
--- /dev/null
+++ b/apps/studio/components/interfaces/ConnectSheet/WarehouseModePanel/WarehouseModePanel.utils.ts
@@ -0,0 +1,101 @@
+import type { components } from 'api-types'
+
+import { INTERNAL_SCHEMAS } from '@/hooks/useProtectedSchemas'
+
+export type WarehouseSetupBody = components['schemas']['WarehouseSetupBody']
+export type WarehouseSetupTarget = WarehouseSetupBody['targets'][number]
+
+/** Selection map keyed by `${schema}.${table}`. */
+export type SchemaTableSelection = Record<string, boolean>
+
+export type SchemaWithTables = { schema: string; tables: string[] }
+
+export function getSchemaTableKey(schema: string, table: string): string {
+ return `${schema}.${table}`
+}
+
+/**
+ * Internal schemas that still hold product data users legitimately want in their warehouse.
+ * Everything else in `INTERNAL_SCHEMAS` is Supabase infrastructure — `vault` (secrets),
+ * `pgsodium`, `cron`/`pgmq` bookkeeping, migration history — which should never be offered as a
+ * replication target.
+ */
+const REPLICABLE_INTERNAL_SCHEMAS = ['auth', 'storage']
+
+const NON_SELECTABLE_SCHEMAS = new Set(
+ INTERNAL_SCHEMAS.filter((schema) => !REPLICABLE_INTERNAL_SCHEMAS.includes(schema))
+)
+
+/** Postgres schemas Warehouse setup shouldn't offer for replication. */
+export function isSelectableWarehouseSchema(schemaName: string): boolean {
+ return !schemaName.startsWith('pg_') && !NON_SELECTABLE_SCHEMAS.has(schemaName)
+}
+
+export function getSelectedTableCount(selection: SchemaTableSelection): number {
+ return Object.values(selection).filter(Boolean).length
+}
+
+/**
+ * Seeds the picker's selection from the tables already in the `supabase_warehouse` publication, so
+ * editing an existing setup starts from what's actually replicated instead of an empty selection.
+ * Schema-level checkboxes derive from these per-table entries, so a schema whose every table is in
+ * the publication ends up fully checked on its own.
+ */
+export function buildSelectionFromPublicationTables(
+ publicationTables: { schema: string; name: string }[]
+): SchemaTableSelection {
+ return publicationTables.reduce<SchemaTableSelection>((selection, table) => {
+ selection[getSchemaTableKey(table.schema, table.name)] = true
+ return selection
+ }, {})
+}
+
+/**
+ * Tri-state value for a schema's checkbox. Kept here (rather than inlined as nested ternaries in
+ * the picker) so the three cases stay explicit and testable.
+ */
+export function getSchemaCheckedState({
+ selectedCount,
+ totalCount,
+}: {
+ selectedCount: number
+ totalCount: number
+}): boolean | 'indeterminate' {
+ if (totalCount > 0 && selectedCount === totalCount) return true
+ if (selectedCount > 0) return 'indeterminate'
+ return false
+}
+
+/**
+ * Maps the schema/table checkbox selection down to the API's `targets` shape. A schema whose
+ * every currently-known table is selected is sent as a single `{ type: 'schema' }` target
+ * (matching the API's semantics of "the currently eligible tables in that schema"); otherwise each
+ * selected table is sent individually. Schemas with no tables, or no selected tables, are omitted.
+ */
+export function buildWarehouseSetupTargets(
+ selection: SchemaTableSelection,
+ schemasWithTables: SchemaWithTables[]
+): WarehouseSetupTarget[] {
+ const targets: WarehouseSetupTarget[] = []
+
+ for (const { schema, tables } of schemasWithTables) {
+ if (tables.length === 0) continue
+
+ const selectedTables = tables.filter((table) => selection[getSchemaTableKey(schema, table)])
+ if (selectedTables.length === 0) continue
+
+ if (selectedTables.length === tables.length) {
+ targets.push({ type: 'schema', schema })
+ } else {
+ selectedTables.forEach((name) => {
+ targets.push({ type: 'table', schema, name })
+ })
+ }
+ }
+
+ return targets
+}
+
+export type WarehouseCatalogCredentials = NonNullable<
+ components['schemas']['WarehouseCatalogResponse']['credentials']
+>
diff --git a/apps/studio/components/interfaces/ConnectSheet/WarehouseModePanel/WarehouseSchemaTablePicker.tsx b/apps/studio/components/interfaces/ConnectSheet/WarehouseModePanel/WarehouseSchemaTablePicker.tsx
new file mode 100644
index 00000000000..6e0fa09a66e
--- /dev/null
+++ b/apps/studio/components/interfaces/ConnectSheet/WarehouseModePanel/WarehouseSchemaTablePicker.tsx
@@ -0,0 +1,261 @@
+import { useParams } from 'common'
+import { ArrowLeft, ChevronRight, Warehouse } from 'lucide-react'
+import { useMemo, useState } from 'react'
+import { Button, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger } from 'ui'
+import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'
+
+import {
+ buildSelectionFromPublicationTables,
+ buildWarehouseSetupTargets,
+ getSchemaCheckedState,
+ getSchemaTableKey,
+ getSelectedTableCount,
+ isSelectableWarehouseSchema,
+ type SchemaTableSelection,
+ type SchemaWithTables,
+ type WarehouseSetupTarget,
+} from './WarehouseModePanel.utils'
+import { AlertError } from '@/components/ui/AlertError'
+import { useSchemasQuery } from '@/data/database/schemas-query'
+import { useReplicationPublicationsQuery } from '@/data/replication/publications-query'
+import { useReplicationSourcesQuery } from '@/data/replication/sources-query'
+import { useTablesQuery } from '@/data/tables/tables-query'
+import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
+import { WAREHOUSE_PUBLICATION_NAME } from '@/lib/warehouse'
+
+export interface WarehouseSchemaTablePickerProps {
+ onSubmit: (targets: WarehouseSetupTarget[]) => void
+ isSubmitting: boolean
+ /**
+ * Provided only when the picker was opened to edit an already-enabled Warehouse, which is what
+ * gives it something to navigate back to (the connection details).
+ */
+ onBack?: () => void
+}
+
+export const WarehouseSchemaTablePicker = ({
+ onSubmit,
+ isSubmitting,
+ onBack,
+}: WarehouseSchemaTablePickerProps) => {
+ const { ref: projectRef } = useParams()
+ const { data: project } = useSelectedProjectQuery()
+ const isEditing = onBack !== undefined
+
+ // `null` until the user touches a checkbox, so the selection seeded from the existing
+ // publication can arrive asynchronously without an effect syncing it into state.
+ const [selectionOverride, setSelectionOverride] = useState<SchemaTableSelection | null>(null)
+ const [expandedOverrides, setExpandedOverrides] = useState<Record<string, boolean>>({})
+
+ const {
+ data: schemas,
+ isPending: isSchemasPending,
+ isError: isSchemasError,
+ error: schemasError,
+ } = useSchemasQuery({ projectRef, connectionString: project?.connectionString })
+
+ const {
+ data: tables,
+ isPending: isTablesPending,
+ isError: isTablesError,
+ error: tablesError,
+ } = useTablesQuery({ projectRef, connectionString: project?.connectionString })
+
+ // The `supabase_warehouse` publication is the source of truth for what's currently replicated.
+ // Reading the sources query directly (rather than via useReplicationSourceId) to get its
+ // loading state: the publications query stays disabled until a source id exists, so without it
+ // the list would render un-checked and then flash back to a loader once publications kick in.
+ const { data: sourcesData, isLoading: isSourcesLoading } = useReplicationSourcesQuery({
+ projectRef,
+ })
+ const sourceId = sourcesData?.sources.find((source) => source.name === projectRef)?.id
+
+ const {
+ data: publications,
+ isError: isPublicationsError,
+ error: publicationsError,
+ } = useReplicationPublicationsQuery({ projectRef, sourceId })
+
+ // Derived from data presence rather than fetch status, so there's no render gap between the
+ // publications query becoming enabled and it actually starting to fetch.
+ const isSelectionPending =
+ isSourcesLoading ||
+ (sourceId !== undefined && publications === undefined && !isPublicationsError)
+
+ const initialSelection = useMemo(() => {
+ const warehousePublication = publications?.find(
+ (publication) => publication.name === WAREHOUSE_PUBLICATION_NAME
+ )
+ return buildSelectionFromPublicationTables(warehousePublication?.tables ?? [])
+ }, [publications])
+
+ const selection = selectionOverride ?? initialSelection
+
+ const schemasWithTables: SchemaWithTables[] = useMemo(() => {
+ if (!schemas || !tables) return []
+ return schemas
+ .filter((schema) => isSelectableWarehouseSchema(schema.name))
+ .map((schema) => ({
+ schema: schema.name,
+ tables: tables.filter((table) => table.schema === schema.name).map((table) => table.name),
+ }))
+ .sort((a, b) => a.schema.localeCompare(b.schema))
+ }, [schemas, tables])
+
+ const selectedCount = getSelectedTableCount(selection)
+
+ const updateSelection = (updater: (current: SchemaTableSelection) => SchemaTableSelection) => {
+ setSelectionOverride((prev) => updater(prev ?? initialSelection))
+ }
+
+ const toggleTable = (schema: string, table: string) => {
+ const key = getSchemaTableKey(schema, table)
+ updateSelection((current) => ({ ...current, [key]: !current[key] }))
+ }
+
+ const toggleSchema = (schema: SchemaWithTables) => {
+ const allSelected =
+ schema.tables.length > 0 &&
+ schema.tables.every((table) => selection[getSchemaTableKey(schema.schema, table)])
+
+ updateSelection((current) => {
+ const next = { ...current }
+ schema.tables.forEach((table) => {
+ next[getSchemaTableKey(schema.schema, table)] = !allSelected
+ })
+ return next
+ })
+ }
+
+ const setExpanded = (schemaName: string, isOpen: boolean) => {
+ setExpandedOverrides((prev) => ({ ...prev, [schemaName]: isOpen }))
+ }
+
+ const handleSubmit = () => {
+ const targets = buildWarehouseSetupTargets(selection, schemasWithTables)
+ if (targets.length === 0) return
+ onSubmit(targets)
+ }
+
+ // Waiting on the publication too, so the pre-checked selection is in place before the user can
+ // start toggling (an early toggle would otherwise pin an override that omits existing tables).
+ if (isSchemasPending || isTablesPending || isSelectionPending) return <GenericSkeletonLoader />
+ if (isSchemasError) return <AlertError subject="Failed to load schemas" error={schemasError} />
+ if (isTablesError) return <AlertError subject="Failed to load tables" error={tablesError} />
+ // Only blocking when editing: a first-time setup starts from an empty selection anyway, so a
+ // failed publication lookup shouldn't stop the user from enabling Warehouse at all.
+ if (isEditing && isPublicationsError) {
+ return <AlertError subject="Failed to load replicated tables" error={publicationsError} />
+ }
+
+ return (
+ <div>
+ <div className="flex gap-3 mb-5">
+ <div className="w-8 h-8 rounded-md bg-brand-200 flex items-center justify-center shrink-0">
+ <Warehouse size={16} strokeWidth={1.5} className="text-brand" />
+ </div>
+ <div>
+ <p className="text-sm font-medium text-foreground">
+ {isEditing ? 'Edit replicated tables' : 'Enable Warehouse'}
+ </p>
+ <p className="text-sm text-foreground-light mt-1 max-w-xl">
+ {isEditing
+ ? 'Choose which schemas or tables to replicate to your Warehouse. Tables already replicating are selected.'
+ : 'Replicate your database to a low-latency analytical endpoint over FlightSQL. Choose which schemas or tables to replicate — you can change this later.'}
+ </p>
+ </div>
+ </div>
+
+ <p className="text-sm font-medium text-foreground-light mb-2">
+ Schemas and tables to replicate
+ </p>
+
+ <div className="border rounded-md overflow-hidden divide-y">
+ {schemasWithTables.map((schema) => {
+ const keys = schema.tables.map((table) => getSchemaTableKey(schema.schema, table))
+ const checkedCount = keys.filter((key) => selection[key]).length
+ const checkedState = getSchemaCheckedState({
+ selectedCount: checkedCount,
+ totalCount: keys.length,
+ })
+ const isOpen = expandedOverrides[schema.schema] ?? checkedCount > 0
+
+ return (
+ <Collapsible
+ key={schema.schema}
+ open={isOpen}
+ onOpenChange={(open) => setExpanded(schema.schema, open)}
+ >
+ <div className="flex items-center gap-2 px-3 py-2 bg-surface-75">
+ <CollapsibleTrigger
+ aria-label={isOpen ? `Collapse ${schema.schema}` : `Expand ${schema.schema}`}
+ className="group text-foreground-lighter"
+ >
+ <ChevronRight
+ size={14}
+ className="transition-transform group-data-[state=open]:rotate-90"
+ />
+ </CollapsibleTrigger>
+ <Checkbox
+ checked={checkedState}
+ onCheckedChange={() => toggleSchema(schema)}
+ disabled={schema.tables.length === 0}
+ aria-label={`Select all tables in ${schema.schema}`}
+ // The shared Checkbox only fills itself for `data-state=checked`, so a partial
+ // selection would otherwise render identically to an empty one. A muted fill
+ // keeps all three states visually distinct.
+ className="data-[state=indeterminate]:border-foreground-lighter data-[state=indeterminate]:bg-foreground-lighter"
+ />
+ <span className="text-sm font-mono text-foreground">{schema.schema}</span>
+ <span className="text-xs text-foreground-lighter ml-auto">
+ {checkedCount}/{keys.length} tables
+ </span>
+ </div>
+ <CollapsibleContent>
+ {schema.tables.map((table) => {
+ const key = getSchemaTableKey(schema.schema, table)
+ return (
+ <div key={key} className="flex items-center gap-2 pl-10 pr-3 py-2">
+ <Checkbox
+ checked={!!selection[key]}
+ onCheckedChange={() => toggleTable(schema.schema, table)}
+ aria-label={`Select ${schema.schema}.${table}`}
+ />
+ <span className="text-sm font-mono text-foreground-light">{table}</span>
+ </div>
+ )
+ })}
+ {schema.tables.length === 0 && (
+ <p className="pl-10 pr-3 py-2 text-sm text-foreground-lighter">
+ No tables in this schema.
+ </p>
+ )}
+ </CollapsibleContent>
+ </Collapsible>
+ )
+ })}
+ </div>
+
+ <div className="flex items-center justify-between mt-4">
+ <span className="text-sm text-foreground-lighter">
+ {selectedCount} table{selectedCount === 1 ? '' : 's'} selected
+ </span>
+ <div className="flex items-center gap-2">
+ {isEditing && (
+ <Button variant="default" icon={<ArrowLeft size={14} />} onClick={onBack}>
+ Back
+ </Button>
+ )}
+ <Button
+ variant="primary"
+ disabled={selectedCount === 0}
+ loading={isSubmitting}
+ onClick={handleSubmit}
+ >
+ {isEditing ? 'Update replicated tables' : 'Enable Warehouse'}
+ </Button>
+ </div>
+ </div>
+ </div>
+ )
+}
diff --git a/apps/studio/components/interfaces/ConnectSheet/__tests__/WarehouseModePanel.utils.test.ts b/apps/studio/components/interfaces/ConnectSheet/__tests__/WarehouseModePanel.utils.test.ts
new file mode 100644
index 00000000000..4acbf8dc3e7
--- /dev/null
+++ b/apps/studio/components/interfaces/ConnectSheet/__tests__/WarehouseModePanel.utils.test.ts
@@ -0,0 +1,205 @@
+import { describe, expect, test } from 'vitest'
+
+import {
+ buildSelectionFromPublicationTables,
+ buildWarehouseSetupTargets,
+ getSchemaCheckedState,
+ getSchemaTableKey,
+ getSelectedTableCount,
+ isSelectableWarehouseSchema,
+ type SchemaTableSelection,
+ type SchemaWithTables,
+} from '../WarehouseModePanel/WarehouseModePanel.utils'
+
+describe('WarehouseModePanel.utils:isSelectableWarehouseSchema', () => {
+ test('excludes information_schema', () => {
+ expect(isSelectableWarehouseSchema('information_schema')).toBe(false)
+ })
+
+ test('excludes any schema starting with pg_', () => {
+ expect(isSelectableWarehouseSchema('pg_catalog')).toBe(false)
+ expect(isSelectableWarehouseSchema('pg_toast')).toBe(false)
+ })
+
+ test('excludes Supabase infrastructure schemas', () => {
+ // Replicating secrets or internal bookkeeping into a warehouse is never intended
+ expect(isSelectableWarehouseSchema('vault')).toBe(false)
+ expect(isSelectableWarehouseSchema('pgsodium')).toBe(false)
+ expect(isSelectableWarehouseSchema('realtime')).toBe(false)
+ expect(isSelectableWarehouseSchema('_realtime')).toBe(false)
+ expect(isSelectableWarehouseSchema('cron')).toBe(false)
+ expect(isSelectableWarehouseSchema('supabase_migrations')).toBe(false)
+ expect(isSelectableWarehouseSchema('extensions')).toBe(false)
+ })
+
+ test('includes public and other user schemas', () => {
+ expect(isSelectableWarehouseSchema('public')).toBe(true)
+ expect(isSelectableWarehouseSchema('analytics')).toBe(true)
+ })
+
+ test('includes auth and storage, which hold product data users replicate', () => {
+ expect(isSelectableWarehouseSchema('auth')).toBe(true)
+ expect(isSelectableWarehouseSchema('storage')).toBe(true)
+ })
+})
+
+describe('WarehouseModePanel.utils:buildSelectionFromPublicationTables', () => {
+ test('returns an empty selection when the publication has no tables', () => {
+ expect(buildSelectionFromPublicationTables([])).toEqual({})
+ })
+
+ test('marks every publication table as selected', () => {
+ expect(
+ buildSelectionFromPublicationTables([
+ { schema: 'public', name: 'orders' },
+ { schema: 'auth', name: 'users' },
+ ])
+ ).toEqual({ 'public.orders': true, 'auth.users': true })
+ })
+
+ test('produces a fully checked schema when every table of that schema is published', () => {
+ const schemaTables = ['orders', 'customers']
+ const selection = buildSelectionFromPublicationTables(
+ schemaTables.map((name) => ({ schema: 'public', name }))
+ )
+ const selectedCount = schemaTables.filter(
+ (name) => selection[getSchemaTableKey('public', name)]
+ ).length
+
+ expect(getSchemaCheckedState({ selectedCount, totalCount: schemaTables.length })).toBe(true)
+ })
+
+ test('produces an indeterminate schema when only some of its tables are published', () => {
+ const selection = buildSelectionFromPublicationTables([{ schema: 'public', name: 'orders' }])
+ const selectedCount = ['orders', 'customers'].filter(
+ (name) => selection[getSchemaTableKey('public', name)]
+ ).length
+
+ expect(getSchemaCheckedState({ selectedCount, totalCount: 2 })).toBe('indeterminate')
+ })
+
+ test('round-trips through buildWarehouseSetupTargets as a schema target when fully published', () => {
+ const schemas: SchemaWithTables[] = [{ schema: 'public', tables: ['orders', 'customers'] }]
+ const selection = buildSelectionFromPublicationTables([
+ { schema: 'public', name: 'orders' },
+ { schema: 'public', name: 'customers' },
+ ])
+
+ expect(buildWarehouseSetupTargets(selection, schemas)).toEqual([
+ { type: 'schema', schema: 'public' },
+ ])
+ })
+})
+
+describe('WarehouseModePanel.utils:getSchemaCheckedState', () => {
+ test('is unchecked when nothing is selected', () => {
+ expect(getSchemaCheckedState({ selectedCount: 0, totalCount: 3 })).toBe(false)
+ })
+
+ test('is indeterminate when only some tables are selected', () => {
+ expect(getSchemaCheckedState({ selectedCount: 1, totalCount: 3 })).toBe('indeterminate')
+ expect(getSchemaCheckedState({ selectedCount: 2, totalCount: 3 })).toBe('indeterminate')
+ })
+
+ test('is checked when every table is selected', () => {
+ expect(getSchemaCheckedState({ selectedCount: 3, totalCount: 3 })).toBe(true)
+ })
+
+ test('is unchecked for an empty schema rather than checked', () => {
+ expect(getSchemaCheckedState({ selectedCount: 0, totalCount: 0 })).toBe(false)
+ })
+})
+
+describe('WarehouseModePanel.utils:getSchemaTableKey', () => {
+ test('joins schema and table with a dot', () => {
+ expect(getSchemaTableKey('public', 'orders')).toBe('public.orders')
+ })
+})
+
+describe('WarehouseModePanel.utils:getSelectedTableCount', () => {
+ test('returns 0 for an empty selection', () => {
+ expect(getSelectedTableCount({})).toBe(0)
+ })
+
+ test('counts only truthy entries', () => {
+ const selection: SchemaTableSelection = {
+ 'public.orders': true,
+ 'public.customers': false,
+ 'public.events': true,
+ }
+ expect(getSelectedTableCount(selection)).toBe(2)
+ })
+})
+
+describe('WarehouseModePanel.utils:buildWarehouseSetupTargets', () => {
+ test('returns an empty array for an empty selection', () => {
+ const schemas: SchemaWithTables[] = [{ schema: 'public', tables: ['orders', 'customers'] }]
+ expect(buildWarehouseSetupTargets({}, schemas)).toEqual([])
+ })
+
+ test('returns an empty array when there are no schemas', () => {
+ expect(buildWarehouseSetupTargets({ 'public.orders': true }, [])).toEqual([])
+ })
+
+ test('emits a schema target when every table in that schema is selected', () => {
+ const schemas: SchemaWithTables[] = [{ schema: 'public', tables: ['orders', 'customers'] }]
+ const selection: SchemaTableSelection = {
+ 'public.orders': true,
+ 'public.customers': true,
+ }
+ expect(buildWarehouseSetupTargets(selection, schemas)).toEqual([
+ { type: 'schema', schema: 'public' },
+ ])
+ })
+
+ test('emits per-table targets when only some tables in a schema are selected', () => {
+ const schemas: SchemaWithTables[] = [{ schema: 'public', tables: ['orders', 'customers'] }]
+ const selection: SchemaTableSelection = {
+ 'public.orders': true,
+ 'public.customers': false,
+ }
+ expect(buildWarehouseSetupTargets(selection, schemas)).toEqual([
+ { type: 'table', schema: 'public', name: 'orders' },
+ ])
+ })
+
+ test('skips schemas with no tables', () => {
+ const schemas: SchemaWithTables[] = [{ schema: 'empty_schema', tables: [] }]
+ expect(buildWarehouseSetupTargets({ 'empty_schema.foo': true }, schemas)).toEqual([])
+ })
+
+ test('skips schemas with no selected tables', () => {
+ const schemas: SchemaWithTables[] = [{ schema: 'public', tables: ['orders'] }]
+ expect(buildWarehouseSetupTargets({ 'public.orders': false }, schemas)).toEqual([])
+ })
+
+ test('ignores selection keys that reference tables outside the given schemas', () => {
+ const schemas: SchemaWithTables[] = [{ schema: 'public', tables: ['orders'] }]
+ const selection: SchemaTableSelection = {
+ 'public.orders': true,
+ 'other.table': true,
+ }
+ expect(buildWarehouseSetupTargets(selection, schemas)).toEqual([
+ { type: 'schema', schema: 'public' },
+ ])
+ })
+
+ test('handles multiple schemas with a mix of full, partial, and no selection', () => {
+ const schemas: SchemaWithTables[] = [
+ { schema: 'public', tables: ['orders', 'customers'] },
+ { schema: 'auth', tables: ['users', 'sessions'] },
+ { schema: 'storage', tables: ['objects'] },
+ ]
+ const selection: SchemaTableSelection = {
+ 'public.orders': true,
+ 'public.customers': true,
+ 'auth.users': true,
+ 'auth.sessions': false,
+ 'storage.objects': false,
+ }
+ expect(buildWarehouseSetupTargets(selection, schemas)).toEqual([
+ { type: 'schema', schema: 'public' },
+ { type: 'table', schema: 'auth', name: 'users' },
+ ])
+ })
+})
diff --git a/apps/studio/components/interfaces/ConnectSheet/connect.schema.ts b/apps/studio/components/interfaces/ConnectSheet/connect.schema.ts
index e04b96085c7..c7f1e3eb325 100644
--- a/apps/studio/components/interfaces/ConnectSheet/connect.schema.ts
+++ b/apps/studio/components/interfaces/ConnectSheet/connect.schema.ts
@@ -289,6 +289,12 @@ export const connectSchema: ConnectSchema = {
description: 'Connect your agent',
fields: ['mcpClient', 'mcpReadonly', 'mcpFeatures'],
},
+ {
+ id: 'warehouse',
+ label: 'Warehouse',
+ description: 'Connect to Warehouse',
+ fields: [],
+ },
],
// -------------------------------------------------------------------------
@@ -467,6 +473,9 @@ export const connectSchema: ConnectSchema = {
},
},
server: [serverInstallStep, serverEnvStep, serverSkillsInstallStep],
+ // Warehouse renders its own fully custom panel (WarehouseModePanel) instead of the
+ // generic field/step abstraction, so it has no steps of its own here.
+ warehouse: [],
DEFAULT: [skillsInstallStep],
},
},
diff --git a/apps/studio/components/interfaces/ConnectSheet/useAvailableConnectModes.ts b/apps/studio/components/interfaces/ConnectSheet/useAvailableConnectModes.ts
index 0fff82dfa37..904b953749a 100644
--- a/apps/studio/components/interfaces/ConnectSheet/useAvailableConnectModes.ts
+++ b/apps/studio/components/interfaces/ConnectSheet/useAvailableConnectModes.ts
@@ -2,6 +2,7 @@ import { useMemo } from 'react'
import type { ConnectMode } from './Connect.types'
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
+import { useIsWarehouseEnabled } from '@/hooks/misc/useIsWarehouseEnabled'
export function useAvailableConnectModes(): ConnectMode[] {
const {
@@ -13,6 +14,7 @@ export function useAvailableConnectModes(): ConnectMode[] {
'project_connection:show_mobile_frameworks',
'project_connection:show_orms',
])
+ const isWarehouseEnabled = useIsWarehouseEnabled()
return useMemo(() => {
const allModes: { id: ConnectMode; enabled: boolean }[] = [
@@ -21,7 +23,8 @@ export function useAvailableConnectModes(): ConnectMode[] {
{ id: 'direct', enabled: true },
{ id: 'orm', enabled: showOrms },
{ id: 'mcp', enabled: true },
+ { id: 'warehouse', enabled: isWarehouseEnabled },
]
return allModes.filter((m) => m.enabled).map((m) => m.id)
- }, [showAppFrameworks, showMobileFrameworks, showOrms])
+ }, [showAppFrameworks, showMobileFrameworks, showOrms, isWarehouseEnabled])
}
diff --git a/apps/studio/components/interfaces/ProjectCreation/WarehouseFdwCustomImage.constants.ts b/apps/studio/components/interfaces/ProjectCreation/WarehouseFdwCustomImage.constants.ts
new file mode 100644
index 00000000000..2724a2816dc
--- /dev/null
+++ b/apps/studio/components/interfaces/ProjectCreation/WarehouseFdwCustomImage.constants.ts
@@ -0,0 +1,30 @@
+export const WAREHOUSE_FDW_CUSTOM_POSTGRES_VERSION =
+ '15.14.1.138-fdw-warehouse-74b5ba9-r7-adminapi110'
+
+export const WAREHOUSE_FDW_CUSTOM_DB_VERSION = `supabase-postgres-${WAREHOUSE_FDW_CUSTOM_POSTGRES_VERSION}`
+
+export const WAREHOUSE_FDW_CUSTOM_INSTANCE_TYPE = 't4g.micro'
+
+export const WAREHOUSE_FDW_CUSTOM_REGION_NAME = 'Southeast Asia (Singapore)'
+
+export const WAREHOUSE_FDW_CUSTOM_REGION_SELECTION = {
+ type: 'specific',
+ code: 'ap-southeast-1',
+} as const
+
+export const WAREHOUSE_FDW_CUSTOM_REQUEST = {
+ enabled: true,
+ secret_region: 'ap-southeast-1',
+ endpoint: 'https://quaxy-flight-staging.fdw-warehouse.supabase.green',
+ tls_domain_name: 'quaxy-flight-staging.fdw-warehouse.supabase.green',
+ jwt_kid: 'fdw-warehouse-staging',
+ jwt_issuer: 'fdw-warehouse',
+ jwt_audience: 'quaxy-flight',
+ jwt_ttl_secs: 300,
+} as const
+
+export const normalizeCustomPostgresVersion = (version?: string) =>
+ version?.trim().replace(/^supabase-postgres-/, '') ?? ''
+
+export const isWarehouseFdwCustomPostgresVersion = (version?: string) =>
+ normalizeCustomPostgresVersion(version) === WAREHOUSE_FDW_CUSTOM_POSTGRES_VERSION
diff --git a/apps/studio/data/warehouse/keys.ts b/apps/studio/data/warehouse/keys.ts
new file mode 100644
index 00000000000..40edb741a87
--- /dev/null
+++ b/apps/studio/data/warehouse/keys.ts
@@ -0,0 +1,6 @@
+export const warehouseKeys = {
+ setupStatus: (projectRef: string | undefined) =>
+ ['projects', projectRef, 'warehouse', 'setup-status'] as const,
+ catalog: (projectRef: string | undefined) =>
+ ['projects', projectRef, 'warehouse', 'catalog'] as const,
+}
diff --git a/apps/studio/data/warehouse/warehouse-catalog-mutation.ts b/apps/studio/data/warehouse/warehouse-catalog-mutation.ts
new file mode 100644
index 00000000000..6c82e469c41
--- /dev/null
+++ b/apps/studio/data/warehouse/warehouse-catalog-mutation.ts
@@ -0,0 +1,63 @@
+import { useMutation, useQueryClient } from '@tanstack/react-query'
+import { components } from 'api-types'
+import { toast } from 'sonner'
+
+import { warehouseKeys } from './keys'
+import { handleError, post } from '@/data/fetchers'
+import type { ResponseError, UseCustomMutationOptions } from '@/types'
+
+export type UpdateWarehouseCatalogBody = components['schemas']['UpdateWarehouseCatalogBody']
+
+export type UpdateWarehouseCatalogVariables = {
+ projectRef: string
+ body: UpdateWarehouseCatalogBody
+}
+
+async function updateWarehouseCatalog({ projectRef, body }: UpdateWarehouseCatalogVariables) {
+ if (!projectRef) throw new Error('projectRef is required')
+
+ const { data, error } = await post('/platform/warehouse/{ref}/catalog', {
+ params: { path: { ref: projectRef } },
+ body,
+ })
+ if (error) {
+ handleError(error)
+ }
+
+ return data
+}
+
+export type UpdateWarehouseCatalogData = Awaited<ReturnType<typeof updateWarehouseCatalog>>
+
+export const useUpdateWarehouseCatalogMutation = ({
+ onSuccess,
+ onError,
+ ...options
+}: Omit<
+ UseCustomMutationOptions<
+ UpdateWarehouseCatalogData,
+ ResponseError,
+ UpdateWarehouseCatalogVariables
+ >,
+ 'mutationFn'
+> = {}) => {
+ const queryClient = useQueryClient()
+
+ return useMutation<UpdateWarehouseCatalogData, ResponseError, UpdateWarehouseCatalogVariables>({
+ mutationFn: (vars) => updateWarehouseCatalog(vars),
+ async onSuccess(data, variables, context) {
+ await queryClient.invalidateQueries({
+ queryKey: warehouseKeys.catalog(variables.projectRef),
+ })
+ await onSuccess?.(data, variables, context)
+ },
+ async onError(error, variables, context) {
+ if (onError === undefined) {
+ toast.error(`Failed to update Warehouse catalog access: ${error.message}`)
+ } else {
+ onError(error, variables, context)
+ }
+ },
+ ...options,
+ })
+}
diff --git a/apps/studio/data/warehouse/warehouse-catalog-query.ts b/apps/studio/data/warehouse/warehouse-catalog-query.ts
new file mode 100644
index 00000000000..b1ad89dcfd1
--- /dev/null
+++ b/apps/studio/data/warehouse/warehouse-catalog-query.ts
@@ -0,0 +1,43 @@
+import { useQuery } from '@tanstack/react-query'
+import { components } from 'api-types'
+
+import { warehouseKeys } from './keys'
+import { get, handleError } from '@/data/fetchers'
+import type { ResponseError, UseCustomQueryOptions } from '@/types'
+
+export type WarehouseCatalogResponse = components['schemas']['WarehouseCatalogResponse']
+
+type WarehouseCatalogVariables = { projectRef?: string }
+
+async function getWarehouseCatalog(
+ { projectRef }: WarehouseCatalogVariables,
+ signal?: AbortSignal
+) {
+ if (!projectRef) throw new Error('projectRef is required')
+
+ const { data, error } = await get('/platform/warehouse/{ref}/catalog', {
+ params: { path: { ref: projectRef } },
+ signal,
+ })
+ if (error) {
+ handleError(error)
+ }
+
+ return data
+}
+
+export type WarehouseCatalogData = Awaited<ReturnType<typeof getWarehouseCatalog>>
+
+export const useWarehouseCatalogQuery = <TData = WarehouseCatalogData>(
+ { projectRef }: WarehouseCatalogVariables,
+ {
+ enabled = true,
+ ...options
+ }: UseCustomQueryOptions<WarehouseCatalogData, ResponseError, TData> = {}
+) =>
+ useQuery<WarehouseCatalogData, ResponseError, TData>({
+ queryKey: warehouseKeys.catalog(projectRef),
+ queryFn: ({ signal }) => getWarehouseCatalog({ projectRef }, signal),
+ enabled: enabled && typeof projectRef !== 'undefined',
+ ...options,
+ })
diff --git a/apps/studio/data/warehouse/warehouse-setup-mutation.ts b/apps/studio/data/warehouse/warehouse-setup-mutation.ts
new file mode 100644
index 00000000000..579c2c43d18
--- /dev/null
+++ b/apps/studio/data/warehouse/warehouse-setup-mutation.ts
@@ -0,0 +1,59 @@
+import { useMutation, useQueryClient } from '@tanstack/react-query'
+import { components } from 'api-types'
+import { toast } from 'sonner'
+
+import { warehouseKeys } from './keys'
+import { handleError, post } from '@/data/fetchers'
+import type { ResponseError, UseCustomMutationOptions } from '@/types'
+
+export type WarehouseSetupBody = components['schemas']['WarehouseSetupBody']
+
+export type WarehouseSetupVariables = {
+ projectRef: string
+ body: WarehouseSetupBody
+}
+
+async function setupWarehouse({ projectRef, body }: WarehouseSetupVariables) {
+ if (!projectRef) throw new Error('projectRef is required')
+
+ const { data, error } = await post('/platform/warehouse/{ref}/setup', {
+ params: { path: { ref: projectRef } },
+ body,
+ })
+ if (error) {
+ handleError(error)
+ }
+
+ return data
+}
+
+export type WarehouseSetupData = Awaited<ReturnType<typeof setupWarehouse>>
+
+export const useWarehouseSetupMutation = ({
+ onSuccess,
+ onError,
+ ...options
+}: Omit<
+ UseCustomMutationOptions<WarehouseSetupData, ResponseError, WarehouseSetupVariables>,
+ 'mutationFn'
+> = {}) => {
+ const queryClient = useQueryClient()
+
+ return useMutation<WarehouseSetupData, ResponseError, WarehouseSetupVariables>({
+ mutationFn: (vars) => setupWarehouse(vars),
+ async onSuccess(data, variables, context) {
+ await queryClient.invalidateQueries({
+ queryKey: warehouseKeys.setupStatus(variables.projectRef),
+ })
+ await onSuccess?.(data, variables, context)
+ },
+ async onError(error, variables, context) {
+ if (onError === undefined) {
+ toast.error(`Failed to set up Warehouse: ${error.message}`)
+ } else {
+ onError(error, variables, context)
+ }
+ },
+ ...options,
+ })
+}
diff --git a/apps/studio/data/warehouse/warehouse-setup-status-query.ts b/apps/studio/data/warehouse/warehouse-setup-status-query.ts
new file mode 100644
index 00000000000..28334c96706
--- /dev/null
+++ b/apps/studio/data/warehouse/warehouse-setup-status-query.ts
@@ -0,0 +1,43 @@
+import { useQuery } from '@tanstack/react-query'
+import { components } from 'api-types'
+
+import { warehouseKeys } from './keys'
+import { get, handleError } from '@/data/fetchers'
+import type { ResponseError, UseCustomQueryOptions } from '@/types'
+
+export type WarehouseSetupStatusResponse = components['schemas']['WarehouseSetupStatusResponse']
+
+type WarehouseSetupStatusVariables = { projectRef?: string }
+
+async function getWarehouseSetupStatus(
+ { projectRef }: WarehouseSetupStatusVariables,
+ signal?: AbortSignal
+) {
+ if (!projectRef) throw new Error('projectRef is required')
+
+ const { data, error } = await get('/platform/warehouse/{ref}/setup-status', {
+ params: { path: { ref: projectRef } },
+ signal,
+ })
+ if (error) {
+ handleError(error)
+ }
+
+ return data
+}
+
+export type WarehouseSetupStatusData = Awaited<ReturnType<typeof getWarehouseSetupStatus>>
+
+export const useWarehouseSetupStatusQuery = <TData = WarehouseSetupStatusData>(
+ { projectRef }: WarehouseSetupStatusVariables,
+ {
+ enabled = true,
+ ...options
+ }: UseCustomQueryOptions<WarehouseSetupStatusData, ResponseError, TData> = {}
+) =>
+ useQuery<WarehouseSetupStatusData, ResponseError, TData>({
+ queryKey: warehouseKeys.setupStatus(projectRef),
+ queryFn: ({ signal }) => getWarehouseSetupStatus({ projectRef }, signal),
+ enabled: enabled && typeof projectRef !== 'undefined',
+ ...options,
+ })
diff --git a/apps/studio/hooks/misc/useIsWarehouseEnabled.ts b/apps/studio/hooks/misc/useIsWarehouseEnabled.ts
new file mode 100644
index 00000000000..65209a42534
--- /dev/null
+++ b/apps/studio/hooks/misc/useIsWarehouseEnabled.ts
@@ -0,0 +1,42 @@
+import { useQuery } from '@tanstack/react-query'
+import { getStringArrayFlag, useParams } from 'common'
+
+import { useIsFeatureEnabled } from './useIsFeatureEnabled'
+import { useSelectedOrganizationQuery } from './useSelectedOrganization'
+import { IS_PLATFORM } from '@/lib/constants'
+
+/**
+ * ConfigCat flag holding a comma-separated allow-list of org slugs (or the `'none'` sentinel for an
+ * empty list), targeted per-project via `targetingKey`.
+ */
+const WAREHOUSE_CONFIGCAT_FLAG_KEY = 'warehouse'
+const WAREHOUSE_ALLOW_ALL_SENTINEL = 'all'
+
+/**
+ * Returns whether the Warehouse tab should be shown in the Connect dialog.
+ *
+ * The API gates every `/platform/warehouse/{ref}/*` call against the same ConfigCat `warehouse`
+ * flag, so this mirrors that check client-side and tab visibility matches what the API allows.
+ */
+export function useIsWarehouseEnabled(): boolean {
+ const { ref: projectRef } = useParams()
+ const { projectConnectionShowWarehouse: isFeatureFlagEnabled } = useIsFeatureEnabled([
+ 'project_connection:show_warehouse',
+ ])
+ const { data: organization } = useSelectedOrganizationQuery({ enabled: IS_PLATFORM })
+
+ const { data: allowedOrgSlugs, isSuccess } = useQuery({
+ queryKey: ['warehouse-configcat-flag', projectRef],
+ queryFn: () => getStringArrayFlag(WAREHOUSE_CONFIGCAT_FLAG_KEY, projectRef!),
+ enabled: IS_PLATFORM && isFeatureFlagEnabled && !!projectRef,
+ staleTime: 5 * 60 * 1000,
+ })
+
+ if (!IS_PLATFORM || !isFeatureFlagEnabled) return false
+ if (!isSuccess || !organization?.slug) return false
+
+ return (
+ allowedOrgSlugs.includes(WAREHOUSE_ALLOW_ALL_SENTINEL) ||
+ allowedOrgSlugs.includes(organization.slug)
+ )
+}
diff --git a/apps/studio/lib/warehouse.test.ts b/apps/studio/lib/warehouse.test.ts
new file mode 100644
index 00000000000..d79e17d059e
--- /dev/null
+++ b/apps/studio/lib/warehouse.test.ts
@@ -0,0 +1,103 @@
+import { describe, expect, test } from 'vitest'
+
+import {
+ getDuckLakeSetupScript,
+ parseWarehouseCatalogUrl,
+ type WarehouseCatalogConnection,
+} from './warehouse'
+
+const CREDENTIALS = {
+ data_path: 's3://warehouse/',
+ metadata_schema: 'ducklake',
+ s3_access_key_id: '9bca431b472accc23f8eb6de9f36259b',
+ s3_endpoint: 'fcdidtxgcaijqkrrngdt.storage.supabase.red/storage/v1/s3',
+ s3_region: 'ap-southeast-1',
+}
+
+const CONNECTION: WarehouseCatalogConnection = {
+ host: 'db.fcdidtxgcaijqkrrngdt.supabase.co',
+ port: '5432',
+ database: 'postgres',
+ user: 'postgres',
+ password: 'catalog-password',
+}
+
+describe('parseWarehouseCatalogUrl', () => {
+ test('splits a full Postgres URL into its parts', () => {
+ expect(
+ parseWarehouseCatalogUrl('postgres://postgres:[email protected]:5432/postgres')
+ ).toEqual({
+ host: 'db.example.supabase.co',
+ port: '5432',
+ database: 'postgres',
+ user: 'postgres',
+ password: 'pwd',
+ })
+ })
+
+ test('falls back to the default port and database when omitted', () => {
+ expect(parseWarehouseCatalogUrl('postgres://postgres:[email protected]')).toEqual({
+ host: 'db.example.supabase.co',
+ port: '5432',
+ database: 'postgres',
+ user: 'postgres',
+ password: 'pwd',
+ })
+ })
+
+ test('decodes percent-encoded credentials', () => {
+ const parsed = parseWarehouseCatalogUrl(
+ 'postgres://user%40name:p%40ss%[email protected]:5432/postgres'
+ )
+ expect(parsed?.user).toBe('user@name')
+ expect(parsed?.password).toBe('p@ss:word')
+ })
+
+ test('keeps a non-default database name', () => {
+ expect(parseWarehouseCatalogUrl('postgres://u:p@host:5432/catalog_db')?.database).toBe(
+ 'catalog_db'
+ )
+ })
+
+ test('returns null for values that are not URLs', () => {
+ expect(parseWarehouseCatalogUrl('')).toBeNull()
+ expect(parseWarehouseCatalogUrl('not a url')).toBeNull()
+ })
+})
+
+describe('getDuckLakeSetupScript', () => {
+ const script = getDuckLakeSetupScript({ credentials: CREDENTIALS, connection: CONNECTION })
+
+ test('creates all three secrets and attaches via the secret identifier', () => {
+ expect(script).toContain('CREATE OR REPLACE SECRET ducklake_s3 (')
+ expect(script).toContain('CREATE OR REPLACE SECRET ducklake_metadata (')
+ expect(script).toContain('CREATE OR REPLACE SECRET ducklake_warehouse (')
+ expect(script).toContain("ATTACH 'ducklake:ducklake_warehouse' AS warehouse;")
+ })
+
+ test('reads both passwords from environment variables instead of inlining them', () => {
+ expect(script).toContain("SECRET getenv('DUCKLAKE_S3_SECRET')")
+ expect(script).toContain("PASSWORD getenv('DUCKLAKE_METADATA_PASSWORD')")
+ expect(script).not.toContain(CONNECTION.password)
+ })
+
+ test('inlines the non-secret catalog and storage values', () => {
+ expect(script).toContain(`KEY_ID '${CREDENTIALS.s3_access_key_id}'`)
+ expect(script).toContain(`REGION '${CREDENTIALS.s3_region}'`)
+ expect(script).toContain(`ENDPOINT '${CREDENTIALS.s3_endpoint}'`)
+ expect(script).toContain(`HOST '${CONNECTION.host}'`)
+ expect(script).toContain(`PORT ${CONNECTION.port}`)
+ expect(script).toContain(`DATABASE '${CONNECTION.database}'`)
+ expect(script).toContain(`USER '${CONNECTION.user}'`)
+ expect(script).toContain(`DATA_PATH '${CREDENTIALS.data_path}'`)
+ })
+
+ test('sets METADATA_SCHEMA explicitly, since DuckLake defaults it to main', () => {
+ expect(script).toContain(`METADATA_SCHEMA '${CREDENTIALS.metadata_schema}'`)
+ })
+
+ test('binds the metadata secret into the DuckLake secret', () => {
+ expect(script).toContain("'SECRET': 'ducklake_metadata'")
+ expect(script).toContain("METADATA_PATH ''")
+ })
+})
diff --git a/apps/studio/lib/warehouse.ts b/apps/studio/lib/warehouse.ts
new file mode 100644
index 00000000000..8a5c9967b70
--- /dev/null
+++ b/apps/studio/lib/warehouse.ts
@@ -0,0 +1,119 @@
+import { PASSWORD_PLACEHOLDER } from '@/components/interfaces/ConnectSheet/ConnectionString.utils'
+import { IS_STAGING_OR_LOCAL } from '@/lib/constants'
+
+const WAREHOUSE_TLD = IS_STAGING_OR_LOCAL ? 'red' : 'io'
+
+/**
+ * Name of the singleton replication publication (and destination) that Warehouse manages. Its table
+ * list is the source of truth for what's currently replicated.
+ */
+export const WAREHOUSE_PUBLICATION_NAME = 'supabase_warehouse'
+
+export function getWarehouseFlightSqlEndpoint(projectRef: string): string {
+ return `${projectRef}.warehouse.supabase.${WAREHOUSE_TLD}`
+}
+
+export function getWarehouseFlightSqlConnectionString(projectRef: string): string {
+ const endpoint = getWarehouseFlightSqlEndpoint(projectRef)
+ // The password is the project's database password. It's never fetched or displayed here --
+ // mirroring how the direct-connection tab shows a placeholder instead of the real secret.
+ return `flightsql://postgres:${PASSWORD_PLACEHOLDER}@${endpoint}:443?tls=enabled`
+}
+
+export function getWarehouseUsqlCommand(projectRef: string): string {
+ const endpoint = getWarehouseFlightSqlEndpoint(projectRef)
+ return `usql -X -W 'flightsql://postgres@${endpoint}:443?tls=enabled'`
+}
+
+/** Environment variables the DuckLake setup script reads secrets from. */
+export const DUCKLAKE_S3_SECRET_ENV_VAR = 'DUCKLAKE_S3_SECRET'
+export const DUCKLAKE_METADATA_PASSWORD_ENV_VAR = 'DUCKLAKE_METADATA_PASSWORD'
+
+export interface WarehouseCatalogConnection {
+ host: string
+ port: string
+ database: string
+ user: string
+ password: string
+}
+
+/**
+ * Splits the DuckLake catalog Postgres URL into the parts DuckDB's `TYPE postgres` secret expects
+ * as individual options. Returns null when the URL can't be parsed, so callers can fall back to
+ * surfacing the raw value instead of emitting a broken script.
+ */
+export function parseWarehouseCatalogUrl(catalogUrl: string): WarehouseCatalogConnection | null {
+ try {
+ const url = new URL(catalogUrl)
+ if (!url.hostname) return null
+
+ return {
+ host: url.hostname,
+ port: url.port || '5432',
+ database: url.pathname.replace(/^\//, '') || 'postgres',
+ user: decodeURIComponent(url.username) || 'postgres',
+ password: decodeURIComponent(url.password),
+ }
+ } catch {
+ return null
+ }
+}
+
+/**
+ * Full DuckDB script for attaching the project's Warehouse: an S3 secret for the data files, a
+ * Postgres secret for the metadata catalog, a DuckLake secret binding the two, then the attach.
+ *
+ * Both passwords are read via `getenv()` rather than inlined, so the script is safe to copy into a
+ * shared file — the values themselves are surfaced separately in the UI.
+ *
+ * `METADATA_SCHEMA` is set explicitly because DuckLake defaults it to `main`, not to the schema the
+ * platform provisions.
+ */
+export function getDuckLakeSetupScript({
+ credentials,
+ connection,
+}: {
+ credentials: {
+ data_path: string
+ metadata_schema: string
+ s3_access_key_id: string
+ s3_endpoint: string
+ s3_region: string
+ }
+ connection: WarehouseCatalogConnection
+}): string {
+ return `-- 1. S3 credentials for reading the Warehouse data files
+CREATE OR REPLACE SECRET ducklake_s3 (
+ TYPE s3,
+ KEY_ID '${credentials.s3_access_key_id}',
+ SECRET getenv('${DUCKLAKE_S3_SECRET_ENV_VAR}'),
+ REGION '${credentials.s3_region}',
+ ENDPOINT '${credentials.s3_endpoint}',
+ URL_STYLE 'path'
+);
+
+-- 2. Postgres credentials for the DuckLake metadata catalog
+CREATE OR REPLACE SECRET ducklake_metadata (
+ TYPE postgres,
+ HOST '${connection.host}',
+ PORT ${connection.port},
+ DATABASE '${connection.database}',
+ USER '${connection.user}',
+ PASSWORD getenv('${DUCKLAKE_METADATA_PASSWORD_ENV_VAR}')
+);
+
+-- 3. Bind the metadata secret into a DuckLake secret configuration
+CREATE OR REPLACE SECRET ducklake_warehouse (
+ TYPE ducklake,
+ METADATA_PATH '',
+ DATA_PATH '${credentials.data_path}',
+ METADATA_SCHEMA '${credentials.metadata_schema}',
+ METADATA_PARAMETERS MAP {
+ 'TYPE': 'postgres',
+ 'SECRET': 'ducklake_metadata'
+ }
+);
+
+-- 4. Clean attach using only the secret identifier
+ATTACH 'ducklake:ducklake_warehouse' AS warehouse;`
+}
diff --git a/knip.jsonc b/knip.jsonc
index 1f537e739fa..aca56276b11 100644
--- a/knip.jsonc
+++ b/knip.jsonc
@@ -73,6 +73,11 @@
// this file so `enumMembers` keeps working everywhere else.
"data/database/constraints-query.ts": ["enumMembers"],
"hooks/misc/useTrackExperimentExposure.ts": ["files"],
+ // Staging-only pinned Postgres image + FDW request payload for creating
+ // Warehouse test projects by hand. Nothing imports it yet — it's kept
+ // alongside the rest of the Warehouse work so the values stay in one
+ // place until the project-creation surface that consumes them lands.
+ "components/interfaces/ProjectCreation/WarehouseFdwCustomImage.constants.ts": ["files"],
},
// `vercel` is a globally installed CLI used by the `deploy:staging` script
"ignoreBinaries": ["vercel"],
diff --git a/packages/common/configcat.ts b/packages/common/configcat.ts
index f1a2522bc73..f8a405097dc 100644
--- a/packages/common/configcat.ts
+++ b/packages/common/configcat.ts
@@ -56,6 +56,25 @@ async function getClient() {
}
}
+/**
+ * Reads a ConfigCat string-array-style flag, targeted by `targetingKey` rather than user email. The
+ * flag value is a comma-separated list, or the `'none'` sentinel for an empty list.
+ */
+export async function getStringArrayFlag(flagKey: string, targetingKey: string): Promise<string[]> {
+ const client = await getClient()
+ if (!client) return []
+
+ await client.waitForReady()
+
+ const rawValue = await client.getValueAsync(flagKey, '', new configcat.User(targetingKey))
+ if (!rawValue || rawValue === 'none') return []
+
+ return rawValue
+ .split(',')
+ .map((value) => value.trim())
+ .filter(Boolean)
+}
+
export async function getFlags(userEmail: string = '', customAttributes?: Record<string, string>) {
const client = await getClient()
const _customAttributes = {
diff --git a/packages/common/enabled-features/enabled-features.json b/packages/common/enabled-features/enabled-features.json
index bdf512b1e13..e1a7a682b44 100644
--- a/packages/common/enabled-features/enabled-features.json
+++ b/packages/common/enabled-features/enabled-features.json
@@ -99,6 +99,7 @@
"project_connection:show_app_frameworks": true,
"project_connection:show_mobile_frameworks": true,
"project_connection:show_orms": true,
+ "project_connection:show_warehouse": true,
"project_creation:show_advanced_config": true,
diff --git a/packages/common/enabled-features/enabled-features.schema.json b/packages/common/enabled-features/enabled-features.schema.json
index 4ca4fda54b8..463df741ebf 100644
--- a/packages/common/enabled-features/enabled-features.schema.json
+++ b/packages/common/enabled-features/enabled-features.schema.json
@@ -345,6 +345,10 @@
"type": "boolean",
"description": "Show the orms tab in the connect modal"
},
+ "project_connection:show_warehouse": {
+ "type": "boolean",
+ "description": "Show the warehouse tab in the connect modal"
+ },
"project_creation:show_advanced_config": {
"type": "boolean",
@@ -531,6 +535,7 @@
"project_connection:show_app_frameworks",
"project_connection:show_mobile_frameworks",
"project_connection:show_orms",
+ "project_connection:show_warehouse",
"quickstarts:hide_nimbus",
"reports:all",
"sdk:auth",
diff --git a/packages/common/telemetry-constants.ts b/packages/common/telemetry-constants.ts
index c8ccbd5b671..6492cccb0bd 100644
--- a/packages/common/telemetry-constants.ts
+++ b/packages/common/telemetry-constants.ts
@@ -2375,7 +2375,7 @@ export interface HomeConnectActionClickedEvent {
/**
* The connect action/tile that was clicked
*/
- mode: 'framework' | 'direct' | 'orm' | 'mcp' | 'server' | 'api_keys'
+ mode: 'framework' | 'direct' | 'orm' | 'mcp' | 'server' | 'warehouse' | 'api_keys'
}
groups: TelemetryGroups
}