Skip to content

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

Decouple foreign schema creation from vector buckets (#41258)

Joshen Lim77944aca9a1b
diff --git a/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/NamespaceWithTables/TableRowComponent.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/NamespaceWithTables/TableRowComponent.tsx
index 7c018dc3f4f..154b4006cea 100644
--- a/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/NamespaceWithTables/TableRowComponent.tsx
+++ b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/NamespaceWithTables/TableRowComponent.tsx
@@ -9,7 +9,7 @@ import {
convertKVStringArrayToJson,
formatWrapperTables,
} from 'components/interfaces/Integrations/Wrappers/Wrappers.utils'
-import { getDecryptedParameters } from 'components/interfaces/Storage/ImportForeignSchemaDialog.utils'
+import { getDecryptedParameters } from 'components/interfaces/Storage/Storage.utils'
import { DotPing } from 'components/ui/DotPing'
import { DropdownMenuItemTooltip } from 'components/ui/DropdownMenuItemTooltip'
import { useFDWDropForeignTableMutation } from 'data/fdw/fdw-drop-foreign-table-mutation'
@@ -194,6 +194,7 @@ export const TableRowComponent = ({ table, schema, namespace }: TableRowComponen
ref: project?.ref,
connectionString: project?.connectionString ?? undefined,
wrapper: wrapperInstance,
+ wrapperMeta,
})
const formValues: Record<string, string> = {
wrapper_name: wrapperInstance.name,
diff --git a/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/NamespaceWithTables/index.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/NamespaceWithTables/index.tsx
index e7083db2c2a..fed71877001 100644
--- a/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/NamespaceWithTables/index.tsx
+++ b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/NamespaceWithTables/index.tsx
@@ -5,7 +5,6 @@ import { toast } from 'sonner'
import { useParams } from 'common'
import { FormattedWrapperTable } from 'components/interfaces/Integrations/Wrappers/Wrappers.utils'
import { ImportForeignSchemaDialog } from 'components/interfaces/Storage/ImportForeignSchemaDialog'
-import { useProjectSettingsV2Query } from 'data/config/project-settings-v2-query'
import { useFDWDropForeignTableMutation } from 'data/fdw/fdw-drop-foreign-table-mutation'
import { useFDWImportForeignSchemaMutation } from 'data/fdw/fdw-import-foreign-schema-mutation'
import { useIcebergNamespaceDeleteMutation } from 'data/storage/iceberg-namespace-delete-mutation'
@@ -66,7 +65,6 @@ export const NamespaceWithTables = ({
const [showConfirmDeleteNamespace, setShowConfirmDeleteNamespace] = useState(false)
const [isDeletingNamespace, setIsDeletingNamespace] = useState(false)
- const { data: projectSettings } = useProjectSettingsV2Query({ projectRef })
const { publication, icebergWrapper } = useAnalyticsBucketAssociatedEntities({
projectRef,
bucketId,
diff --git a/apps/studio/components/interfaces/Storage/AnalyticsBuckets/CreateAnalyticsBucketModal.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/CreateAnalyticsBucketModal.tsx
index 6ca9035d2d9..bb8bd0c54c1 100644
--- a/apps/studio/components/interfaces/Storage/AnalyticsBuckets/CreateAnalyticsBucketModal.tsx
+++ b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/CreateAnalyticsBucketModal.tsx
@@ -176,11 +176,10 @@ export const CreateAnalyticsBucketModal = ({
schema: wrappersExtension.schema ?? 'extensions',
version: wrappersExtension.default_version,
})
- await createIcebergWrapper({ bucketName: values.name })
- } else if (wrappersExtensionState === 'installed') {
- await createIcebergWrapper({ bucketName: values.name })
}
+ await createIcebergWrapper({ bucketName: values.name })
+
sendEvent({
action: 'storage_bucket_created',
properties: { bucketType: 'analytics' },
@@ -207,7 +206,7 @@ export const CreateAnalyticsBucketModal = ({
if (!open) handleClose()
}}
>
- <DialogContent size="large" aria-describedby={undefined}>
+ <DialogContent size="medium" aria-describedby={undefined}>
<DialogHeader>
<DialogTitle>Create {config.singularName} bucket</DialogTitle>
</DialogHeader>
@@ -216,7 +215,7 @@ export const CreateAnalyticsBucketModal = ({
<Form_Shadcn_ {...form}>
<form id={formId} onSubmit={form.handleSubmit(onSubmit)}>
- <DialogSection className="flex flex-col gap-y-4">
+ <DialogSection className="flex flex-col !p-0">
<FormField_Shadcn_
key="name"
name="name"
@@ -224,6 +223,7 @@ export const CreateAnalyticsBucketModal = ({
render={({ field }) => (
<FormItemLayout
name="name"
+ className="p-5"
label="Bucket name"
labelOptional="Cannot be changed after creation"
description="Must be between 3–63 characters. Only lowercase letters, numbers, and hyphens are allowed."
@@ -246,6 +246,7 @@ export const CreateAnalyticsBucketModal = ({
{wrappersExtenstionNeedsUpgrading ? (
<Admonition
type="warning"
+ className="border-x-0 border-b-0 rounded-none"
title="Wrappers extension must be updated for Iceberg Wrapper support"
>
<p className="prose max-w-full text-sm !leading-normal">
@@ -262,7 +263,7 @@ export const CreateAnalyticsBucketModal = ({
</p>
</Admonition>
) : (
- <Admonition type="default">
+ <Admonition type="default" className="border-x-0 border-b-0 rounded-none">
<p className="!leading-normal">
Supabase will install the{' '}
{wrappersExtensionState !== 'installed' ? 'Wrappers extension and ' : ''}
diff --git a/apps/studio/components/interfaces/Storage/ImportForeignSchemaDialog.tsx b/apps/studio/components/interfaces/Storage/ImportForeignSchemaDialog.tsx
index 4aa8e54520c..fe4b4a82a18 100644
--- a/apps/studio/components/interfaces/Storage/ImportForeignSchemaDialog.tsx
+++ b/apps/studio/components/interfaces/Storage/ImportForeignSchemaDialog.tsx
@@ -18,7 +18,7 @@ import { formatWrapperTables } from '../Integrations/Wrappers/Wrappers.utils'
import { SchemaEditor } from '../TableGridEditor/SidePanelEditor/SchemaEditor'
import { getAnalyticsBucketFDWServerName } from './AnalyticsBuckets/AnalyticsBucketDetails/AnalyticsBucketDetails.utils'
import { useAnalyticsBucketAssociatedEntities } from './AnalyticsBuckets/AnalyticsBucketDetails/useAnalyticsBucketAssociatedEntities'
-import { getDecryptedParameters } from './ImportForeignSchemaDialog.utils'
+import { getDecryptedParameters } from './Storage.utils'
export interface ImportForeignSchemaDialogProps {
namespace: string
@@ -111,6 +111,7 @@ export const ImportForeignSchemaDialog = ({
ref: project?.ref,
connectionString: project?.connectionString ?? undefined,
wrapper,
+ wrapperMeta,
})
const formValues: Record<string, string> = {
diff --git a/apps/studio/components/interfaces/Storage/ImportForeignSchemaDialog.utils.ts b/apps/studio/components/interfaces/Storage/ImportForeignSchemaDialog.utils.ts
deleted file mode 100644
index 1b1f6d51720..00000000000
--- a/apps/studio/components/interfaces/Storage/ImportForeignSchemaDialog.utils.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import { type FDW } from 'data/fdw/fdws-query'
-import { getDecryptedValues } from 'data/vault/vault-secret-decrypted-value-query'
-import { INTEGRATIONS } from '../Integrations/Landing/Integrations.constants'
-import { WrapperMeta } from '../Integrations/Wrappers/Wrappers.types'
-import { convertKVStringArrayToJson } from '../Integrations/Wrappers/Wrappers.utils'
-
-export const getDecryptedParameters = async ({
- ref,
- connectionString,
- wrapper,
-}: {
- ref?: string
- connectionString?: string
- wrapper: FDW
-}) => {
- const integration = INTEGRATIONS.find((i) => i.id === 'iceberg_wrapper' && i.type === 'wrapper')
- const wrapperMeta = (integration?.type === 'wrapper' && integration.meta) as WrapperMeta
- const wrapperServerOptions = wrapperMeta.server.options
-
- const serverOptions = convertKVStringArrayToJson(wrapper?.server_options ?? [])
-
- const paramsToBeDecrypted = Object.fromEntries(
- new Map(
- Object.entries(serverOptions).filter(([key, value]) => {
- return wrapperServerOptions.find((option) => option.name === key)?.encrypted
- })
- )
- )
-
- const decryptedValues = await getDecryptedValues({
- projectRef: ref,
- connectionString: connectionString,
- ids: Object.values(paramsToBeDecrypted),
- })
-
- const paramsWithDecryptedValues = Object.fromEntries(
- new Map(
- Object.entries(paramsToBeDecrypted).map(([name, id]) => {
- const decryptedValue = decryptedValues[id]
- return [name, decryptedValue]
- })
- )
- )
-
- return {
- ...serverOptions,
- ...paramsWithDecryptedValues,
- }
-}
diff --git a/apps/studio/components/interfaces/Storage/Storage.utils.ts b/apps/studio/components/interfaces/Storage/Storage.utils.ts
index 9988c45eee8..bb4d1110a84 100644
--- a/apps/studio/components/interfaces/Storage/Storage.utils.ts
+++ b/apps/studio/components/interfaces/Storage/Storage.utils.ts
@@ -2,7 +2,11 @@ import { PostgresPolicy } from '@supabase/postgres-meta'
import { difference } from 'lodash'
import { useRouter } from 'next/router'
+import { WrapperMeta } from 'components/interfaces/Integrations/Wrappers/Wrappers.types'
+import { convertKVStringArrayToJson } from 'components/interfaces/Integrations/Wrappers/Wrappers.utils'
+import { FDW } from 'data/fdw/fdws-query'
import { Bucket } from 'data/storage/buckets-query'
+import { getDecryptedValues } from 'data/vault/vault-secret-decrypted-value-query'
import { createWrappedSymbol } from 'lib/helpers'
import { STORAGE_CLIENT_LIBRARY_MAPPINGS } from './Storage.constants'
import type { StoragePolicyFormField } from './Storage.types'
@@ -213,3 +217,47 @@ export const useStorageV2Page = () => {
const router = useRouter()
return router.pathname.split('/')[4] as undefined | 'files' | 'analytics' | 'vectors' | 's3'
}
+
+export const getDecryptedParameters = async ({
+ ref,
+ connectionString,
+ wrapper,
+ wrapperMeta,
+}: {
+ ref?: string
+ connectionString?: string
+ wrapper: FDW
+ wrapperMeta: WrapperMeta
+}) => {
+ const wrapperServerOptions = wrapperMeta.server.options
+
+ const serverOptions = convertKVStringArrayToJson(wrapper?.server_options ?? [])
+
+ const paramsToBeDecrypted = Object.fromEntries(
+ new Map(
+ Object.entries(serverOptions).filter(([key, value]) => {
+ return wrapperServerOptions.find((option) => option.name === key)?.encrypted
+ })
+ )
+ )
+
+ const decryptedValues = await getDecryptedValues({
+ projectRef: ref,
+ connectionString: connectionString,
+ ids: Object.values(paramsToBeDecrypted),
+ })
+
+ const paramsWithDecryptedValues = Object.fromEntries(
+ new Map(
+ Object.entries(paramsToBeDecrypted).map(([name, id]) => {
+ const decryptedValue = decryptedValues[id]
+ return [name, decryptedValue]
+ })
+ )
+ )
+
+ return {
+ ...serverOptions,
+ ...paramsWithDecryptedValues,
+ }
+}
diff --git a/apps/studio/components/interfaces/Storage/VectorBuckets/CreateVectorBucketDialog.tsx b/apps/studio/components/interfaces/Storage/VectorBuckets/CreateVectorBucketDialog.tsx
index b5d9bf56a09..2b0e1fb7198 100644
--- a/apps/studio/components/interfaces/Storage/VectorBuckets/CreateVectorBucketDialog.tsx
+++ b/apps/studio/components/interfaces/Storage/VectorBuckets/CreateVectorBucketDialog.tsx
@@ -7,7 +7,6 @@ import z from 'zod'
import { useParams } from 'common'
import { InlineLink } from 'components/ui/InlineLink'
import { useDatabaseExtensionEnableMutation } from 'data/database-extensions/database-extension-enable-mutation'
-import { useSchemaCreateMutation } from 'data/database/schema-create-mutation'
import { useS3VectorsWrapperCreateMutation } from 'data/storage/s3-vectors-wrapper-create-mutation'
import { useVectorBucketCreateMutation } from 'data/storage/vector-bucket-create-mutation'
import { useVectorBucketsQuery } from 'data/storage/vector-buckets-query'
@@ -33,7 +32,6 @@ import { Admonition } from 'ui-patterns/admonition'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import { validVectorBucketName } from './CreateVectorBucketDialog.utils'
import { useS3VectorsWrapperExtension } from './useS3VectorsWrapper'
-import { getVectorBucketFDWSchemaName } from './VectorBuckets.utils'
const FormSchema = z.object({
name: z
@@ -112,10 +110,6 @@ export const CreateVectorBucketDialog = ({
const { mutateAsync: createS3VectorsWrapper } = useS3VectorsWrapperCreateMutation()
- const { mutateAsync: createSchema } = useSchemaCreateMutation({
- onError: () => {},
- })
-
const { mutateAsync: enableExtension } = useDatabaseExtensionEnableMutation()
const onSubmit: SubmitHandler<CreateBucketForm> = async (values) => {
@@ -146,23 +140,9 @@ export const CreateVectorBucketDialog = ({
schema: wrappersExtension.schema ?? 'extensions',
version: wrappersExtension.default_version,
})
-
- await createS3VectorsWrapper({ bucketName: values.name })
-
- await createSchema({
- projectRef: project?.ref,
- connectionString: project?.connectionString,
- name: getVectorBucketFDWSchemaName(values.name),
- })
- } else if (wrappersExtensionState === 'installed') {
- await createS3VectorsWrapper({ bucketName: values.name })
-
- await createSchema({
- projectRef: project?.ref,
- connectionString: project?.connectionString,
- name: getVectorBucketFDWSchemaName(values.name),
- })
}
+
+ await createS3VectorsWrapper({ bucketName: values.name })
} catch (error: any) {
toast.warning(
`Failed to create vector bucket integration: ${error.message}. The bucket will be created but you will need to manually install the integration.`
@@ -195,7 +175,7 @@ export const CreateVectorBucketDialog = ({
<Form_Shadcn_ {...form}>
<form id={formId} onSubmit={form.handleSubmit(onSubmit)}>
- <DialogSection className="flex flex-col gap-y-4">
+ <DialogSection className="flex flex-col !p-0">
<FormField_Shadcn_
key="name"
name="name"
@@ -204,8 +184,9 @@ export const CreateVectorBucketDialog = ({
<FormItemLayout
name="name"
label="Bucket name"
+ className="px-5 py-5"
labelOptional="Cannot be changed after creation"
- description="A target schema will be created that matches this name."
+ description="Must be between 3–63 characters. Only lowercase letters, numbers, and hyphens are allowed"
>
<FormControl_Shadcn_>
<Input_Shadcn_
@@ -221,7 +202,8 @@ export const CreateVectorBucketDialog = ({
</FormItemLayout>
)}
/>
- <Admonition type="default">
+
+ <Admonition type="default" className="border-x-0 border-b-0 rounded-none">
<p>
Supabase will install the{' '}
{wrappersExtensionState !== 'installed' ? 'Wrappers extension and ' : ''}
diff --git a/apps/studio/components/interfaces/Storage/VectorBuckets/CreateVectorTableSheet.tsx b/apps/studio/components/interfaces/Storage/VectorBuckets/CreateVectorTableSheet.tsx
index 0e31de76ea1..77b41165fa7 100644
--- a/apps/studio/components/interfaces/Storage/VectorBuckets/CreateVectorTableSheet.tsx
+++ b/apps/studio/components/interfaces/Storage/VectorBuckets/CreateVectorTableSheet.tsx
@@ -6,13 +6,14 @@ import { useEffect } from 'react'
import { SubmitHandler, useFieldArray, useForm } from 'react-hook-form'
import { toast } from 'sonner'
import z from 'zod'
-import { DOCS_URL } from 'lib/constants'
+
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
import { DocsButton } from 'components/ui/DocsButton'
import { useFDWImportForeignSchemaMutation } from 'data/fdw/fdw-import-foreign-schema-mutation'
import { useVectorBucketIndexCreateMutation } from 'data/storage/vector-bucket-index-create-mutation'
import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
+import { DOCS_URL } from 'lib/constants'
import {
Button,
Form_Shadcn_,
@@ -33,7 +34,6 @@ import {
import { Admonition } from 'ui-patterns'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import { inverseValidBucketNameRegex } from '../CreateBucketModal.utils'
-import { getVectorBucketFDWSchemaName } from './VectorBuckets.utils'
import { useS3VectorsWrapperInstance } from './useS3VectorsWrapperInstance'
const isStagingLocal = process.env.NEXT_PUBLIC_ENVIRONMENT !== 'prod'
@@ -111,6 +111,9 @@ export const CreateVectorTableSheet = ({ bucketName }: CreateVectorTableSheetPro
const { can: canCreateBuckets } = useAsyncCheckPermissions(PermissionAction.STORAGE_WRITE, '*')
const { data: wrapperInstance } = useS3VectorsWrapperInstance({ bucketId: bucketName })
+ const schema = wrapperInstance?.server_options
+ .find((x) => x.startsWith('supabase_target_schema'))
+ ?.split('supabase_target_schema=')[1]
// [Joshen] Can remove this once this restriction is removed
const showIndexCreationNotice = isStagingLocal && !!project && project?.region !== 'us-east-1'
@@ -143,7 +146,7 @@ export const CreateVectorTableSheet = ({ bucketName }: CreateVectorTableSheetPro
const onSubmit: SubmitHandler<CreateVectorTableForm> = async (values) => {
if (!project?.ref) return console.error('Project ref is required')
- if (!bucketName) return
+ if (!bucketName) return console.error('Bucket name is required')
try {
await createVectorBucketTable({
@@ -161,13 +164,13 @@ export const CreateVectorTableSheet = ({ bucketName }: CreateVectorTableSheetPro
}
try {
- if (wrapperInstance) {
+ if (wrapperInstance && !!schema) {
await importForeignSchema({
projectRef: project.ref,
connectionString: project?.connectionString,
serverName: wrapperInstance.server_name,
- sourceSchema: getVectorBucketFDWSchemaName(bucketName),
- targetSchema: getVectorBucketFDWSchemaName(bucketName),
+ sourceSchema: schema,
+ targetSchema: schema,
schemaOptions: [`bucket_name '${bucketName}'`],
})
}
diff --git a/apps/studio/components/interfaces/Storage/VectorBuckets/DeleteVectorTableModal.tsx b/apps/studio/components/interfaces/Storage/VectorBuckets/DeleteVectorTableModal.tsx
index 6c4902c68a5..352fbcc6e20 100644
--- a/apps/studio/components/interfaces/Storage/VectorBuckets/DeleteVectorTableModal.tsx
+++ b/apps/studio/components/interfaces/Storage/VectorBuckets/DeleteVectorTableModal.tsx
@@ -1,11 +1,12 @@
import { toast } from 'sonner'
+import { useParams } from 'common'
import { useFDWDropForeignTableMutation } from 'data/fdw/fdw-drop-foreign-table-mutation'
import { useVectorBucketIndexDeleteMutation } from 'data/storage/vector-bucket-index-delete-mutation'
import { VectorBucketIndex } from 'data/storage/vector-buckets-indexes-query'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'
-import { getVectorBucketFDWSchemaName } from './VectorBuckets.utils'
+import { useS3VectorsWrapperInstance } from './useS3VectorsWrapperInstance'
interface DeleteVectorTableModalProps {
visible: boolean
@@ -18,22 +19,34 @@ export const DeleteVectorTableModal = ({
table,
onClose,
}: DeleteVectorTableModalProps) => {
+ const { bucketId } = useParams()
const { data: project } = useSelectedProjectQuery()
- const { mutate: deleteForeignTable } = useFDWDropForeignTableMutation({
+ const { data: wrapperInstance } = useS3VectorsWrapperInstance({ bucketId })
+ const foreignTable = wrapperInstance?.tables?.find((x) => x.name === table?.indexName)
+
+ const { mutateAsync: deleteForeignTable } = useFDWDropForeignTableMutation({
onError: () => {},
})
const { mutate: deleteIndex, isPending: isDeleting } = useVectorBucketIndexDeleteMutation({
onSuccess: (_, vars) => {
- deleteForeignTable({
- projectRef: project?.ref,
- connectionString: project?.connectionString,
- schemaName: getVectorBucketFDWSchemaName(vars.bucketName),
- tableName: vars.indexName,
- })
- toast.success(`Table "${vars.indexName}" deleted successfully`)
- onClose()
+ try {
+ if (!!foreignTable) {
+ deleteForeignTable({
+ projectRef: project?.ref,
+ connectionString: project?.connectionString,
+ schemaName: foreignTable.schema,
+ tableName: foreignTable.name,
+ })
+ }
+ toast.success(`Table "${vars.indexName}" deleted successfully`)
+ onClose()
+ } catch (error: any) {
+ toast.success(
+ `Table "${vars.indexName}" deleted successfully, but its corresponding foreign table failed to clean up: ${error.message}`
+ )
+ }
},
})
diff --git a/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/InitializeForeignSchemaDialog.tsx b/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/InitializeForeignSchemaDialog.tsx
new file mode 100644
index 00000000000..bb79a037b79
--- /dev/null
+++ b/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/InitializeForeignSchemaDialog.tsx
@@ -0,0 +1,175 @@
+import { zodResolver } from '@hookform/resolvers/zod'
+import { parseAsBoolean, useQueryState } from 'nuqs'
+import { useState } from 'react'
+import { SubmitHandler, useForm } from 'react-hook-form'
+import { toast } from 'sonner'
+import z from 'zod'
+
+import { useQueryClient } from '@tanstack/react-query'
+import { useParams } from 'common'
+import { formatWrapperTables } from 'components/interfaces/Integrations/Wrappers/Wrappers.utils'
+import { DocsButton } from 'components/ui/DocsButton'
+import { useSchemaCreateMutation } from 'data/database/schema-create-mutation'
+import { useSchemasQuery } from 'data/database/schemas-query'
+import { useFDWImportForeignSchemaMutation } from 'data/fdw/fdw-import-foreign-schema-mutation'
+import { useFDWUpdateMutation } from 'data/fdw/fdw-update-mutation'
+import { fdwKeys } from 'data/fdw/keys'
+import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
+import { DOCS_URL } from 'lib/constants'
+import {
+ Button,
+ Dialog,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogSection,
+ DialogSectionSeparator,
+ DialogTitle,
+ DialogTrigger,
+ Form_Shadcn_,
+ FormField_Shadcn_,
+ Input_Shadcn_,
+} from 'ui'
+import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
+import { getDecryptedParameters } from '../../Storage.utils'
+import { useS3VectorsWrapperInstance } from '../useS3VectorsWrapperInstance'
+
+// Create foreign tables for vector bucket
+export const InitializeForeignSchemaDialog = () => {
+ const queryClient = useQueryClient()
+ const { ref: projectRef, bucketId } = useParams()
+ const { data: project } = useSelectedProjectQuery()
+ const { data: schemas } = useSchemasQuery({ projectRef })
+
+ const [isOpen, setIsOpen] = useQueryState('initForeignSchema', parseAsBoolean.withDefault(false))
+ const [isCreating, setIsCreating] = useState(false)
+
+ const { data: wrapperInstance, meta: wrapperMeta } = useS3VectorsWrapperInstance({ bucketId })
+
+ const FormSchema = z.object({
+ schema: z
+ .string()
+ .trim()
+ .min(1, 'Schema name is required')
+ .refine((val) => !schemas?.find((s) => s.name === val), {
+ message: 'This schema already exists. Please specify a unique schema name.',
+ }),
+ })
+
+ const form = useForm<z.infer<typeof FormSchema>>({
+ resolver: zodResolver(FormSchema),
+ defaultValues: { schema: '' },
+ })
+
+ const { mutateAsync: createSchema } = useSchemaCreateMutation()
+ const { mutateAsync: importForeignSchema } = useFDWImportForeignSchemaMutation()
+ const { mutateAsync: updateFDW } = useFDWUpdateMutation()
+
+ const onSubmit: SubmitHandler<z.infer<typeof FormSchema>> = async (values) => {
+ if (!projectRef) return console.error('Project ref is required')
+ if (!bucketId) return console.error('Bucket ID is required')
+ if (!wrapperInstance) return console.error('Wrapper instance is required')
+
+ try {
+ setIsCreating(true)
+
+ await createSchema({
+ projectRef,
+ connectionString: project?.connectionString,
+ name: values.schema,
+ })
+
+ const serverOptions = await getDecryptedParameters({
+ ref: project?.ref,
+ connectionString: project?.connectionString ?? undefined,
+ wrapper: wrapperInstance,
+ wrapperMeta,
+ })
+
+ const wrapperTables = formatWrapperTables(wrapperInstance, wrapperMeta)
+
+ await updateFDW({
+ projectRef: project?.ref,
+ connectionString: project?.connectionString,
+ wrapper: wrapperInstance,
+ wrapperMeta: wrapperMeta,
+ formState: {
+ wrapper_name: wrapperInstance.name,
+ server_name: wrapperInstance.server_name,
+ supabase_target_schema: values.schema,
+ ...serverOptions,
+ },
+ tables: wrapperTables,
+ skipInvalidation: true,
+ })
+
+ await importForeignSchema({
+ projectRef,
+ connectionString: project?.connectionString,
+ serverName: wrapperInstance.server_name,
+ sourceSchema: values.schema,
+ targetSchema: values.schema,
+ schemaOptions: [`bucket_name '${bucketId}'`],
+ })
+
+ toast.success(
+ `Successfully created "${values.schema}" schema! Data from tables in this bucket can now be queried from there.`
+ )
+ setIsOpen(false)
+
+ await queryClient.invalidateQueries({
+ queryKey: fdwKeys.list(projectRef),
+ refetchType: 'all',
+ })
+ } catch (error: any) {
+ toast.error(`Failed to expose tables: ${error.message}`)
+ } finally {
+ setIsCreating(false)
+ }
+ }
+
+ return (
+ <Dialog open={isOpen} onOpenChange={setIsOpen}>
+ <DialogTrigger asChild>
+ <Button type="default">Query from Postgres</Button>
+ </DialogTrigger>
+ <DialogContent size="medium" aria-describedby={undefined}>
+ <Form_Shadcn_ {...form}>
+ <form onSubmit={form.handleSubmit(onSubmit)}>
+ <DialogHeader>
+ <DialogTitle>Query this vector bucket from Postgres</DialogTitle>
+ </DialogHeader>
+ <DialogSectionSeparator />
+ <DialogSection className="flex flex-col gap-y-4">
+ <p className="text-sm">
+ Data from vector tables can be queried from Postgres with the S3 Vectors Wrapper.
+ Create a Postgres schema to expose tables from the "{bucketId}" bucket as foreign
+ tables.
+ </p>
+ <FormField_Shadcn_
+ control={form.control}
+ name="schema"
+ render={({ field }) => (
+ <FormItemLayout layout="vertical" label="Schema name">
+ <Input_Shadcn_ {...field} placeholder="Provide a name for your schema" />
+ </FormItemLayout>
+ )}
+ />
+ </DialogSection>
+ <DialogFooter className="!justify-between">
+ <DocsButton href={`${DOCS_URL}/guides/storage/vector/querying-vectors`} />
+ <div className="flex items-center gap-x-2">
+ <Button type="default" disabled={isCreating} onClick={() => setIsOpen(false)}>
+ Cancel
+ </Button>
+ <Button htmlType="submit" type="primary" loading={isCreating}>
+ Create schema
+ </Button>
+ </div>
+ </DialogFooter>
+ </form>
+ </Form_Shadcn_>
+ </DialogContent>
+ </Dialog>
+ )
+}
diff --git a/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/VectorBucketCallouts.tsx b/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/VectorBucketCallouts.tsx
index 33a2d025637..c4c45626c75 100644
--- a/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/VectorBucketCallouts.tsx
+++ b/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/VectorBucketCallouts.tsx
@@ -5,13 +5,10 @@ import { WrapperMeta } from 'components/interfaces/Integrations/Wrappers/Wrapper
import { ScaffoldSection } from 'components/layouts/Scaffold'
import { InlineLink } from 'components/ui/InlineLink'
import { DatabaseExtension } from 'data/database-extensions/database-extensions-query'
-import { useSchemaCreateMutation } from 'data/database/schema-create-mutation'
import { useS3VectorsWrapperCreateMutation } from 'data/storage/s3-vectors-wrapper-create-mutation'
-import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { DOCS_URL } from 'lib/constants'
import { Button } from 'ui'
import { Admonition } from 'ui-patterns/admonition'
-import { getVectorBucketFDWSchemaName } from '../VectorBuckets.utils'
export const ExtensionNotInstalled = ({
projectRef,
@@ -100,20 +97,13 @@ export const ExtensionNeedsUpgrade = ({
}
export const WrapperMissing = ({ bucketName }: { bucketName?: string }) => {
- const { data: project } = useSelectedProjectQuery()
const { mutateAsync: createS3VectorsWrapper, isPending: isCreatingS3VectorsWrapper } =
useS3VectorsWrapperCreateMutation()
- const { mutateAsync: createSchema, isPending: isCreatingSchema } = useSchemaCreateMutation()
const onSetupWrapper = async () => {
if (!bucketName) return console.error('Bucket name is required')
try {
await createS3VectorsWrapper({ bucketName })
- await createSchema({
- projectRef: project?.ref,
- connectionString: project?.connectionString,
- name: getVectorBucketFDWSchemaName(bucketName),
- })
} catch (error) {
toast.error(
`Failed to install wrapper: ${error instanceof Error ? error.message : 'Unknown error'}`
@@ -121,13 +111,11 @@ export const WrapperMissing = ({ bucketName }: { bucketName?: string }) => {
}
}
- const isLoading = isCreatingS3VectorsWrapper || isCreatingSchema
-
return (
<ScaffoldSection isFullWidth>
<Admonition type="warning" title="Missing integration">
<p>The S3 Vectors Wrapper integration is required in order to query vector tables.</p>
- <Button type="default" loading={isLoading} onClick={onSetupWrapper}>
+ <Button type="default" loading={isCreatingS3VectorsWrapper} onClick={onSetupWrapper}>
Install wrapper
</Button>
</Admonition>
diff --git a/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/VectorBucketTableExamplesSheet.tsx b/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/VectorBucketTableExamplesSheet.tsx
index e212a75b682..9ececaf5dff 100644
--- a/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/VectorBucketTableExamplesSheet.tsx
+++ b/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/VectorBucketTableExamplesSheet.tsx
@@ -1,9 +1,11 @@
-import { BookOpen, ChevronDown, ListPlus } from 'lucide-react'
+import { ChevronDown, ListPlus } from 'lucide-react'
import Link from 'next/link'
+import { parseAsBoolean, useQueryState } from 'nuqs'
import { useState } from 'react'
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useParams } from 'common'
+import { DocsButton } from 'components/ui/DocsButton'
import { getKeys, useAPIKeysQuery } from 'data/api-keys/api-keys-query'
import { VectorBucketIndex } from 'data/storage/vector-buckets-indexes-query'
import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'
@@ -27,7 +29,8 @@ import {
SheetTitle,
SheetTrigger,
} from 'ui'
-import { getVectorBucketFDWSchemaName } from '../VectorBuckets.utils'
+import { Admonition } from 'ui-patterns'
+import { useS3VectorsWrapperInstance } from '../useS3VectorsWrapperInstance'
interface VectorBucketTableExamplesSheetProps {
index: VectorBucketIndex
@@ -35,16 +38,22 @@ interface VectorBucketTableExamplesSheetProps {
export const VectorBucketTableExamplesSheet = ({ index }: VectorBucketTableExamplesSheetProps) => {
const metadataKeys = index.metadataConfiguration?.nonFilterableMetadataKeys ?? []
+ const [open, setOpen] = useState(false)
const [language, setLanguage] = useState<'javascript' | 'sql'>('sql')
const [showLanguage, setShowLanguage] = useState(false)
+ const [_, setOpenImportForeignSchemaDialog] = useQueryState(
+ 'initForeignSchema',
+ parseAsBoolean.withDefault(false)
+ )
+
const updateLanguage = (value: 'javascript' | 'sql') => {
setLanguage(value)
setShowLanguage(false)
}
return (
- <Sheet>
+ <Sheet open={open} onOpenChange={setOpen}>
{/* Move into overflow menu after vectors added */}
<SheetTrigger asChild>
<Button type="default" icon={<ListPlus size={12} className="text-foreground-lighter" />}>
@@ -67,9 +76,13 @@ export const VectorBucketTableExamplesSheet = ({ index }: VectorBucketTableExamp
dimension={index.dimension}
metadataKeys={metadataKeys}
language={language}
- onLanguageChange={updateLanguage}
showLanguage={showLanguage}
+ onLanguageChange={updateLanguage}
onShowLanguageChange={setShowLanguage}
+ onSelectQueryFromPostgres={() => {
+ setOpen(false)
+ setOpenImportForeignSchemaDialog(true)
+ }}
/>
</div>
</div>
@@ -105,9 +118,10 @@ interface VectorBucketIndexExamplesProps {
dimension: number
metadataKeys: string[]
language: 'javascript' | 'sql'
- onLanguageChange: (value: 'javascript' | 'sql') => void
showLanguage: boolean
+ onLanguageChange: (value: 'javascript' | 'sql') => void
onShowLanguageChange: (show: boolean) => void
+ onSelectQueryFromPostgres: () => void
}
function VectorBucketIndexExamples({
@@ -116,20 +130,22 @@ function VectorBucketIndexExamples({
dimension,
metadataKeys,
language,
- onLanguageChange,
showLanguage,
+ onLanguageChange,
onShowLanguageChange,
+ onSelectQueryFromPostgres,
}: VectorBucketIndexExamplesProps) {
- const { ref: projectRef } = useParams()
+ const { ref: projectRef, bucketId } = useParams()
const { can: canReadAPIKeys } = useAsyncCheckPermissions(
PermissionAction.READ,
'service_api_keys'
)
const { data: apiKeys } = useAPIKeysQuery({ projectRef }, { enabled: canReadAPIKeys })
- const { serviceKey, secretKey } = canReadAPIKeys
- ? getKeys(apiKeys)
- : { serviceKey: null, secretKey: null }
+ const { secretKey } = canReadAPIKeys ? getKeys(apiKeys) : { secretKey: null }
+
+ const { data: wrapperInstance } = useS3VectorsWrapperInstance({ bucketId })
+ const foreignTable = wrapperInstance?.tables?.find((x) => x.name === indexName)
const dimensionLabel = `Data should match ${dimension} dimension${dimension > 1 ? 's' : ''}`
const startValue = 0.1
@@ -139,7 +155,7 @@ function VectorBucketIndexExamples({
const sqlCode = `-- Insert multiple vectors
insert into
- "${getVectorBucketFDWSchemaName(bucketName)}"."${indexName}" (key, data, metadata)
+ "${foreignTable?.schema}"."${foreignTable?.name}" (key, data, metadata)
values
(
'doc-1',
@@ -228,19 +244,9 @@ const result = await index.putVectors({
</PopoverContent_Shadcn_>
</Popover_Shadcn_>
- <Button
- type="default"
- icon={<BookOpen size={12} className="text-foreground-lighter" />}
- asChild
- >
- <Link
- target="_blank"
- rel="noreferrer"
- href={`${DOCS_URL}/guides/storage/vector/storing-vectors?queryGroups=language&language=${language}#basic-vector-insertion`}
- >
- Docs
- </Link>
- </Button>
+ <DocsButton
+ href={`${DOCS_URL}/guides/storage/vector/storing-vectors?queryGroups=language&language=${language}#basic-vector-insertion`}
+ />
</div>
{language === 'javascript' ? (
<CodeBlock
@@ -250,6 +256,17 @@ const result = await index.putVectors({
language="js"
value={jsCode}
/>
+ ) : !foreignTable ? (
+ <Admonition
+ type="default"
+ title="Insert data via SQL with a Foreign Data Wrapper"
+ description="Data from vector tables can be queried and inserted from Postgres with the S3 Vectors Wrapper as foreign tables."
+ actions={
+ <Button type="default" onClick={onSelectQueryFromPostgres}>
+ Query from Postgres
+ </Button>
+ }
+ />
) : (
<>
<CodeBlock
@@ -259,7 +276,7 @@ const result = await index.putVectors({
language="sql"
value={sqlCode}
/>
- <div className="flex justify-end gap-2">
+ <div className="flex justify-end">
<Button
type="default"
asChild
diff --git a/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/index.tsx b/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/index.tsx
index d740223975f..ac3ca1c4bcb 100644
--- a/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/index.tsx
+++ b/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails/index.tsx
@@ -24,6 +24,7 @@ import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
+ DropdownMenuSeparator,
DropdownMenuTrigger,
Table,
TableBody,
@@ -37,10 +38,10 @@ import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'
import { CreateVectorTableSheet } from '../CreateVectorTableSheet'
import { DeleteVectorBucketModal } from '../DeleteVectorBucketModal'
import { DeleteVectorTableModal } from '../DeleteVectorTableModal'
-import { getVectorBucketFDWSchemaName } from '../VectorBuckets.utils'
import { useS3VectorsWrapperExtension } from '../useS3VectorsWrapper'
import { useS3VectorsWrapperInstance } from '../useS3VectorsWrapperInstance'
import { useSelectedVectorBucket } from '../useSelectedVectorBuckets'
+import { InitializeForeignSchemaDialog } from './InitializeForeignSchemaDialog'
import {
ExtensionNeedsUpgrade,
ExtensionNotInstalled,
@@ -51,7 +52,6 @@ import { VectorBucketTableExamplesSheet } from './VectorBucketTableExamplesSheet
export const VectorBucketDetails = () => {
const router = useRouter()
const { ref: projectRef, bucketId } = useParams()
- // [Joshen] Use the list buckets to verify that the bucket exists first before fetching bucket details
const { data: _bucket, isSuccess } = useSelectedVectorBucket()
// Track the ID being deleted to exclude it from error checking
@@ -96,15 +96,17 @@ export const VectorBucketDetails = () => {
)
const { extension: wrappersExtension, state: extensionState } = useS3VectorsWrapperExtension()
+
const {
data: wrapperInstance,
meta: wrapperMeta,
isLoading: isLoadingWrapper,
- } = useS3VectorsWrapperInstance({
- bucketId,
- })
+ } = useS3VectorsWrapperInstance({ bucketId })
const isLoading = isLoadingIndexes || isLoadingWrapper
+ const hasSetUpForeignSchema = wrapperInstance?.server_options.find((x) =>
+ x.startsWith('supabase_target_schema')
+ )
const state = isLoading
? 'loading'
@@ -140,7 +142,10 @@ export const VectorBucketDetails = () => {
icon={<Search />}
className="w-48"
/>
- <CreateVectorTableSheet bucketName={bucket?.vectorBucketName} />
+ <div className="flex items-center gap-x-2">
+ {!!wrapperInstance && !hasSetUpForeignSchema && <InitializeForeignSchemaDialog />}
+ <CreateVectorTableSheet bucketName={bucket?.vectorBucketName} />
+ </div>
</div>
{state === 'not-installed' && (
@@ -210,6 +215,10 @@ export const VectorBucketDetails = () => {
const id = `index-${idx}`
const name = index.indexName
+ const foreignTable = wrapperInstance?.tables?.find(
+ (x) => x.name === index.indexName
+ )
+
return (
<TableRow key={id}>
<TableCell>{name}</TableCell>
@@ -232,15 +241,14 @@ export const VectorBucketDetails = () => {
/>
</DropdownMenuTrigger>
<DropdownMenuContent side="bottom" align="end" className="w-40">
- {wrapperInstance ? (
+ {!!foreignTable ? (
<>
<DropdownMenuItem
className="flex items-center space-x-2"
asChild
>
- {/* TODO: Proper URL for sql editor */}
<Link
- href={`/project/${projectRef}/sql/new?content=${encodeURIComponent(`select * from "${getVectorBucketFDWSchemaName(bucketId!)}"."${name}";`)}`}
+ href={`/project/${projectRef}/sql/new?content=${encodeURIComponent(`select * from "${foreignTable.schema}"."${foreignTable.name}";`)}`}
onClick={(e) => e.stopPropagation()}
>
<SqlEditor
@@ -254,9 +262,8 @@ export const VectorBucketDetails = () => {
className="flex items-center space-x-2"
asChild
>
- {/* TODO: Proper URL for table editor */}
<Link
- href={`/project/${projectRef}/editor/?schema=${getVectorBucketFDWSchemaName(bucketId!)}`}
+ href={`/project/${projectRef}/editor/${foreignTable.id}?schema=${foreignTable.schema}`}
onClick={(e) => e.stopPropagation()}
>
<TableEditor
@@ -266,6 +273,7 @@ export const VectorBucketDetails = () => {
<p>View in Table Editor</p>
</Link>
</DropdownMenuItem>
+ <DropdownMenuSeparator />
</>
) : null}
<DropdownMenuItem
diff --git a/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBuckets.utils.ts b/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBuckets.utils.ts
index 8f6b7152033..2c296c51c36 100644
--- a/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBuckets.utils.ts
+++ b/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBuckets.utils.ts
@@ -4,8 +4,8 @@ export const getVectorBucketS3KeyName = (bucketId: string) => {
return `${snakeCase(bucketId)}_keys`
}
-export const getVectorBucketFDWSchemaName = (bucketId: string) => {
- return `fdw_vector_${snakeCase(bucketId)}`
+export const getVectorBucketFDWServerName = (bucketId: string) => {
+ return `${getVectorBucketFDWName(bucketId)}_server`
}
export const getVectorBucketFDWName = (bucketId: string) => {
diff --git a/apps/studio/data/fdw/fdw-update-mutation.ts b/apps/studio/data/fdw/fdw-update-mutation.ts
index df84fe0ee46..7ef5cefb309 100644
--- a/apps/studio/data/fdw/fdw-update-mutation.ts
+++ b/apps/studio/data/fdw/fdw-update-mutation.ts
@@ -22,6 +22,7 @@ export type FDWUpdateVariables = {
[k: string]: string
}
tables: any[]
+ skipInvalidation?: boolean
}
export const getUpdateFDWSql = ({
@@ -77,14 +78,16 @@ export const useFDWUpdateMutation = ({
return useMutation<FDWUpdateData, ResponseError, FDWUpdateVariables>({
mutationFn: (vars) => updateFDW(vars),
async onSuccess(data, variables, context) {
- const { projectRef } = variables
+ const { projectRef, skipInvalidation = false } = variables
- await Promise.all([
- queryClient.invalidateQueries({ queryKey: fdwKeys.list(projectRef), refetchType: 'all' }),
- queryClient.invalidateQueries({ queryKey: entityTypeKeys.list(projectRef) }),
- queryClient.invalidateQueries({ queryKey: foreignTableKeys.list(projectRef) }),
- queryClient.invalidateQueries({ queryKey: vaultSecretsKeys.list(projectRef) }),
- ])
+ if (!skipInvalidation) {
+ await Promise.all([
+ queryClient.invalidateQueries({ queryKey: fdwKeys.list(projectRef), refetchType: 'all' }),
+ queryClient.invalidateQueries({ queryKey: entityTypeKeys.list(projectRef) }),
+ queryClient.invalidateQueries({ queryKey: foreignTableKeys.list(projectRef) }),
+ queryClient.invalidateQueries({ queryKey: vaultSecretsKeys.list(projectRef) }),
+ ])
+ }
await onSuccess?.(data, variables, context)
},
diff --git a/apps/studio/data/fdw/fdws-query.ts b/apps/studio/data/fdw/fdws-query.ts
index 33a8b426fe0..9b7f249341f 100644
--- a/apps/studio/data/fdw/fdws-query.ts
+++ b/apps/studio/data/fdw/fdws-query.ts
@@ -1,7 +1,7 @@
import { useQuery } from '@tanstack/react-query'
+import { UseCustomQueryOptions } from 'types'
import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query'
import { fdwKeys } from './keys'
-import { UseCustomQueryOptions } from 'types'
export const getFDWsSql = () => {
const sql = /* SQL */ `
diff --git a/apps/studio/data/storage/s3-vectors-wrapper-create-mutation.ts b/apps/studio/data/storage/s3-vectors-wrapper-create-mutation.ts
index 81e6d49714c..2719fc70bb4 100644
--- a/apps/studio/data/storage/s3-vectors-wrapper-create-mutation.ts
+++ b/apps/studio/data/storage/s3-vectors-wrapper-create-mutation.ts
@@ -4,7 +4,7 @@ import { WRAPPERS } from 'components/interfaces/Integrations/Wrappers/Wrappers.c
import { getVectorURI } from 'components/interfaces/Storage/StorageSettings/StorageSettings.utils'
import {
getVectorBucketFDWName,
- getVectorBucketFDWSchemaName,
+ getVectorBucketFDWServerName,
getVectorBucketS3KeyName,
} from 'components/interfaces/Storage/VectorBuckets/VectorBuckets.utils'
import { useProjectSettingsV2Query } from 'data/config/project-settings-v2-query'
@@ -39,6 +39,7 @@ export const useS3VectorsWrapperCreateMutation = () => {
})
const wrapperName = getVectorBucketFDWName(bucketName)
+ const serverName = getVectorBucketFDWServerName(bucketName)
const params: FDWCreateVariables = {
projectRef: project?.ref,
@@ -46,12 +47,11 @@ export const useS3VectorsWrapperCreateMutation = () => {
wrapperMeta: wrapperMeta!,
formState: {
wrapper_name: wrapperName,
- server_name: `${wrapperName}_server`,
+ server_name: serverName,
vault_access_key_id: createS3KeyData?.access_key,
vault_secret_access_key: createS3KeyData?.secret_key,
aws_region: settings!.region,
endpoint_url: getVectorURI(project?.ref ?? '', protocol, endpoint),
- supabase_target_schema: getVectorBucketFDWSchemaName(bucketName),
},
mode: 'skip',
tables: [],
diff --git a/apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx b/apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx
index 31e01d4f394..08c21d744c7 100644
--- a/apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx
+++ b/apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx
@@ -6,7 +6,7 @@ import { useParams } from 'common'
import { BUCKET_TYPES } from 'components/interfaces/Storage/Storage.constants'
import { useSelectedVectorBucket } from 'components/interfaces/Storage/VectorBuckets/useSelectedVectorBuckets'
import { VectorBucketDetails } from 'components/interfaces/Storage/VectorBuckets/VectorBucketDetails'
-import DefaultLayout from 'components/layouts/DefaultLayout'
+import { DefaultLayout } from 'components/layouts/DefaultLayout'
import { PageLayout } from 'components/layouts/PageLayout/PageLayout'
import StorageLayout from 'components/layouts/StorageLayout/StorageLayout'
import { DocsButton } from 'components/ui/DocsButton'