MD_CREATE_DIVE
Public Preview
Dives are currently in public preview and functionality is subject to change.
Creates a new Dive in your MotherDuck account. Returns the created Dive's metadata and initial version information.
Syntax
SELECT * FROM MD_CREATE_DIVE(
title ='My Dive',
content ='<JSX component code>',
description ='A brief description',
api_version =1
);
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
title | VARCHAR | Yes | The title of the Dive |
content | VARCHAR | Yes | The JSX/React component code |
description | VARCHAR | No | A brief description of the Dive |
api_version | UINTEGER | No | API version for the Dive format. Defaults to 1. |
Return Columns
| Column | Type | Description |
|---|---|---|
id | UUID | Unique identifier of the created Dive |
title | VARCHAR | Dive title |
description | VARCHAR | Dive description |
owner_id | UUID | UUID of the Dive owner |
current_version | INTEGER | Version number (1 for newly created Dives) |
created_at | TIMESTAMP WITH TIME ZONE | When the Dive was created |
updated_at | TIMESTAMP WITH TIME ZONE | When the Dive was last updated |
owner_name | VARCHAR | Name of the Dive owner |
version_id | UUID | UUID of the initial version |
version_storage_url | VARCHAR | Storage URL of the version content |
version_description | VARCHAR | Description for this version |
version_created_at | TIMESTAMP WITH TIME ZONE | When this version was created |
version_api_version | UINTEGER | API version used |
Examples
Create a Dive with title and content:
SELECT id, title, current_version
FROM MD_CREATE_DIVE(
title ='Revenue Trends',
content ='import { useSQLQuery } from "@motherduck/react-sql-query";
export default function Dive() {
const { data } = useSQLQuery(`SELECT * FROM sales`);
return <div>{JSON.stringify(data)}</div>;
}'
);
Create a Dive with a description:
SELECT *
FROM MD_CREATE_DIVE(
title ='Monthly Revenue',
description ='Line chart of revenue by month',
content ='<component code>'
);
Related
MD_UPDATE_DIVE_CONTENT— Update a Dive's content (creates a new version)MD_UPDATE_DIVE_METADATA— Update a Dive's title or descriptionsave_diveMCP tool — AI assistant equivalent