---
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
