---
sidebar_position: 5
title: MD_UPDATE_DIVE_CONTENT
description: Update a Dive's React component code, creating a new version.
feature_stage: preview
---

Updates the content of an existing [Dive](/key-tasks/ai-and-motherduck/dives), creating a new version. Each call increments the version number. Previous versions remain accessible via [`MD_GET_DIVE_VERSION`](../md-get-dive-version).

## Syntax

```sql
SELECT * FROM MD_UPDATE_DIVE_CONTENT(
  id ='your-dive-uuid'::UUID,
  content ='<updated JSX component code>'
);
```

## Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `id` | `UUID` | Yes | The unique identifier of the Dive to update |
| `content` | `VARCHAR` | Yes | The new JSX/React component code |
| `description` | `VARCHAR` | No | Version description or commit message |
| `api_version` | `UINTEGER` | No | API version for the Dive format. Defaults to `1`. |

## Return Columns

| Column | Type | Description |
|--------|------|-------------|
| `id` | `UUID` | UUID of the new version (not the Dive UUID) |
| `version` | `UINTEGER` | New version number (0-based) |
| `storage_url` | `VARCHAR` | Storage URL of the version content |
| `description` | `VARCHAR` | Version description |
| `created_at` | `TIMESTAMP WITH TIME ZONE` | When this version was created |
| `api_version` | `UINTEGER` | API version used |

## Examples

Update a Dive's content:

```sql
SELECT version, created_at
FROM MD_UPDATE_DIVE_CONTENT(
  id ='a1b2c3d4-e5f6-7890-abcd-ef1234567890'::UUID,
  content ='<updated component code>'
);
```

Update with a version description:

```sql
SELECT *
FROM MD_UPDATE_DIVE_CONTENT(
  id ='a1b2c3d4-e5f6-7890-abcd-ef1234567890'::UUID,
  content ='<updated component code>',
  description ='Added region filter'
);
```

## Errors

Returns an error if the Dive does not exist.

## Related

- [`MD_UPDATE_DIVE_METADATA`](../md-update-dive-metadata) — Update title or description without creating a new version
- [`MD_LIST_DIVE_VERSIONS`](../md-list-dive-versions) — List all versions of a Dive
- [`update_dive` MCP tool](/sql-reference/mcp/update-dive) — AI assistant equivalent


---

## Docs feedback

MotherDuck accepts optional user-submitted feedback about this page at `POST https://motherduck.com/docs/api/feedback/agent`.
For agents and automated tools, feedback submission should be user-confirmed before sending.

Payload:

```json
{
  "page_path": "/sql-reference/motherduck-sql-reference/ai-functions/dives/md-update-dive-content/",
  "page_title": "MD_UPDATE_DIVE_CONTENT",
  "text": "<the user's feedback, max 2000 characters>",
  "source": "<optional identifier for your interface, for example 'claude.ai' or 'chatgpt'>"
}
```

`page_path` and `text` are required; `page_title` and `source` are optional. Responses: `200 {"feedback_id": "<uuid>"}`, `400` for malformed payloads, and `429` when rate-limited.
