Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions api-docs/influxdb3/enterprise/v3/ref.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1145,8 +1145,29 @@ paths:
Soft deletes a database.
The database is scheduled for deletion and unavailable for querying.
Use the `hard_delete_at` parameter to schedule a hard deletion.
Use the `data_only` parameter to delete data while preserving the database schema and resources.
parameters:
- $ref: '#/components/parameters/db'
- name: data_only
in: query
required: false
schema:
type: boolean
default: false
description: |
Delete only data while preserving the database schema and all associated resources
(tokens, triggers, last value caches, distinct value caches, processing engine configurations).
When `false` (default), the entire database is deleted.
- name: remove_tables
in: query
required: false
schema:
type: boolean
default: false
description: |
Used with `data_only=true` to remove table resources (caches) while preserving
database-level resources (tokens, triggers, processing engine configurations).
Has no effect when `data_only=false`.
- name: hard_delete_at
in: query
required: false
Expand Down Expand Up @@ -1217,6 +1238,7 @@ paths:
Soft deletes a table.
The table is scheduled for deletion and unavailable for querying.
Use the `hard_delete_at` parameter to schedule a hard deletion.
Use the `data_only` parameter to delete data while preserving the table schema and resources.

#### Deleting a table cannot be undone

Expand All @@ -1229,6 +1251,16 @@ paths:
required: true
schema:
type: string
- name: data_only
in: query
required: false
schema:
type: boolean
default: false
description: |
Delete only data while preserving the table schema and all associated resources
(last value caches, distinct value caches).
When `false` (default), the entire table is deleted.
- name: hard_delete_at
in: query
required: false
Expand Down
67 changes: 67 additions & 0 deletions content/shared/influxdb3-admin/databases/delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ the [HTTP API](/influxdb3/version/api/v3/), or [InfluxDB 3 Explorer](/influxdb3/
- [Delete a database using the influxdb3 CLI](#delete-a-database-using-the-influxdb3-cli)
- [Delete a database using the HTTP API](#delete-a-database-using-the-http-api)
- [Delete a database using InfluxDB 3 Explorer](#delete-a-database-using-influxdb-3-explorer)
{{% show-in "enterprise" %}}- [Delete data only (preserve schema and resources)](#delete-data-only-preserve-schema-and-resources){{% /show-in %}}

## Delete a database using the influxdb3 CLI

Expand Down Expand Up @@ -71,3 +72,69 @@ You can also delete databases using the [InfluxDB 3 Explorer](/influxdb3/explore
> This action cannot be undone. All data in the database will be permanently deleted.

For more information, see [Manage databases with InfluxDB 3 Explorer](/influxdb3/explorer/manage-databases/).

{{% show-in "enterprise" %}}
## Delete data only (preserve schema and resources)

{{< product-name >}} supports deleting only the data in a database while preserving the database schema and associated resources.
This is useful when you want to clear old data and re-write new data to the same structure without recreating resources.

### What is preserved

When using the data-only deletion option, the following are preserved:

- **Database schema**: Tables and column definitions
- **Authentication tokens**: Database-scoped access tokens
- **Processing engine configurations**: Triggers and plugin configurations
- **Caches**: Last value caches (LVC) and distinct value caches (DVC)

### Delete data only using the CLI

Use the [`--data-only`](/influxdb3/version/reference/cli/influxdb3/delete/database/#options) flag to delete data while preserving the database schema and resources--for example:

```sh{placeholders="DATABASE_NAME"}
influxdb3 delete database --data-only DATABASE_NAME
```

Replace {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}} with the name of your database.

#### Delete data and remove tables

To delete data and remove table schemas while preserving database-level resources (tokens, triggers, configurations), combine `--data-only` with [`--remove-tables`](/influxdb3/version/reference/cli/influxdb3/delete/database/#options):

```sh{placeholders="DATABASE_NAME"}
influxdb3 delete database --data-only --remove-tables DATABASE_NAME
```

This preserves:
- Authentication tokens
- Processing engine triggers and configurations

But removes:
- All data
- Table schemas
- Table-level caches (LVC and DVC)

### Delete data only using the HTTP API

To delete only data using the HTTP API, include the `data_only=true` query parameter:

```bash{placeholders="DATABASE_NAME|AUTH_TOKEN"}
curl --request DELETE "{{< influxdb/host >}}/api/v3/configure/database?db=DATABASE_NAME&data_only=true" \
--header "Authorization: Bearer AUTH_TOKEN"
```

Replace the following:

- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: the name of the database
- {{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}: your {{% token-link "admin" %}}

#### Delete data and remove tables

To also remove table schemas, add the `remove_tables=true` parameter:

```bash{placeholders="DATABASE_NAME|AUTH_TOKEN"}
curl --request DELETE "{{< influxdb/host >}}/api/v3/configure/database?db=DATABASE_NAME&data_only=true&remove_tables=true" \
--header "Authorization: Bearer AUTH_TOKEN"
```
{{% /show-in %}}
16 changes: 11 additions & 5 deletions content/shared/influxdb3-admin/databases/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The `influxdb3 show databases` command supports output formats:
- `json`
- `jsonl`
- `csv`
<!-- - `parquet` _(must [output to a file](#output-to-a-parquet-file))_ -->
- `parquet` _(must [output to a file](#output-to-a-parquet-file))_

Use the `--format` flag to specify the output format:

Expand Down Expand Up @@ -79,12 +79,18 @@ noaa
{{% /expand %}}
{{< /expand-wrapper >}}

#### Output to Parquet
#### Output to a Parquet file

To output your list of databases to a Parquet file, use the `influxdb3 query` command
[Parquet](https://parquet.apache.org/) is a binary format.
Use the `--output` option to specify the file where you want to save the Parquet data.

- `--format`: `parquet`
- `-o`, `--output`: the filepath to the Parquet file to output to
```sh
influxdb3 show databases \
--format parquet \
--output databases.parquet
```

Alternatively, use the `influxdb3 query` command to query system tables:

```sh
influxdb3 query \
Expand Down
51 changes: 49 additions & 2 deletions content/shared/influxdb3-admin/tables/delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ You can also schedule a hard deletion to permanently remove the table and its da

- [Delete a table using the influxdb3 CLI](#delete-a-table-using-the-influxdb3-cli)
- [Delete a table using the HTTP API](#delete-a-table-using-the-http-api)
{{% show-in "enterprise" %}}- [Delete data only (preserve schema and resources)](#delete-data-only-preserve-schema-and-resources){{% /show-in %}}

## Delete a table using the influxdb3 CLI


Use the `influxdb3 delete table` command to delete a table:

```sh{placeholders="DATABASE_NAME|TABLE_NAME|AUTH_TOKEN"}
Expand Down Expand Up @@ -105,4 +105,51 @@ If the table doesn't exist, the API returns HTTP status `404`:
{
"error": "Table not found"
}
```
```

{{% show-in "enterprise" %}}
## Delete data only (preserve schema and resources)

{{< product-name >}} supports deleting only the data in a table while preserving the table schema and associated resources.
This is useful when you want to clear old data and re-write new data to the same table structure without recreating resources.

### What is preserved

When using the data-only deletion option, the following are preserved:

- **Table schema**: Column definitions and data types
- **Caches**: Last value caches (LVC) and distinct value caches (DVC) associated with the table

### Delete data only using the CLI

Use the [`--data-only`](/influxdb3/version/reference/cli/influxdb3/delete/table/#options) flag to delete data while preserving the table schema and resources:

```sh{placeholders="DATABASE_NAME|TABLE_NAME|AUTH_TOKEN"}
influxdb3 delete table \
--database DATABASE_NAME \
--token AUTH_TOKEN \
--data-only \
TABLE_NAME
```

Replace the following:

- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: the name of the database containing the table
- {{% code-placeholder-key %}}`TABLE_NAME`{{% /code-placeholder-key %}}: the name of the table
- {{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}: your {{% token-link "admin" %}}

### Delete data only using the HTTP API

To delete only data using the HTTP API, include the `data_only=true` query parameter:

```bash{placeholders="DATABASE_NAME|TABLE_NAME|AUTH_TOKEN"}
curl -X DELETE "{{< influxdb/host >}}/api/v3/configure/table?db=DATABASE_NAME&table=TABLE_NAME&data_only=true" \
--header "Authorization: Bearer AUTH_TOKEN"
```

Replace the following:

- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: the name of the database containing the table
- {{% code-placeholder-key %}}`TABLE_NAME`{{% /code-placeholder-key %}}: the name of the table
- {{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}: your {{% token-link "admin" %}}
{{% /show-in %}}
33 changes: 16 additions & 17 deletions content/shared/influxdb3-cli/create/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Provide a database name and, optionally, specify connection settings and authent
<!--pytest.mark.skip-->

```bash
# Syntax
influxdb3 create database [OPTIONS] <DATABASE_NAME>
```

Expand All @@ -29,37 +30,37 @@ You can also set the database name using the `INFLUXDB3_DATABASE_NAME` environme
| | `--retention-period` | Database [retention period](/influxdb3/version/reference/glossary/#retention-period) ([duration](/influxdb3/version/reference/glossary/#duration) value, for example: `30d`, `24h`, `1h`) |
| | `--token` | Authentication token |
| | `--tls-ca` | Path to a custom TLS certificate authority (for testing or self-signed certificates) |
| | `--tls-no-verify` | Disable TLS certificate verification (useful for development or self-signed certificates) |
| `-h` | `--help` | Print help information |
| | `--help-all` | Print detailed help information |

### Option environment variables

You can use the following environment variables instead of providing CLI options directly:

| Environment Variable | Option |
| :------------------------ | :----------- |
| `INFLUXDB3_HOST_URL` | `--host` |
| `INFLUXDB3_AUTH_TOKEN` | `--token` |
| Environment Variable | Option |
| :------------------------ | :---------------- |
| `INFLUXDB3_HOST_URL` | `--host` |
| `INFLUXDB3_AUTH_TOKEN` | `--token` |
| `INFLUXDB3_TLS_NO_VERIFY` | `--tls-no-verify` |

## Examples

The following examples show how to create a database.

In your commands replace the following:
In the examples below, replace the following:
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}:
Database name
- {{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}:
- {{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}:
Authentication token

{{% code-placeholders "DATABASE_NAME|AUTH_TOKEN" %}}

### Create a database (default)

Creates a database using settings from environment variables and defaults.

<!--pytest.mark.skip-->

```bash
```bash { placeholders="DATABASE_NAME" }
influxdb3 create database DATABASE_NAME
```

Expand All @@ -70,7 +71,7 @@ Flags override their associated environment variables.

<!--pytest.mark.skip-->

```bash
```bash { placeholders="AUTH_TOKEN|DATABASE_NAME" }
influxdb3 create database --token AUTH_TOKEN DATABASE_NAME
```

Expand All @@ -81,7 +82,7 @@ Data older than 30 days will not be queryable.

<!--pytest.mark.skip-->

```bash
```bash { placeholders="DATABASE_NAME" }
influxdb3 create database --retention-period 30d DATABASE_NAME
```

Expand All @@ -91,7 +92,7 @@ Creates a database with no retention period (data never expires).

<!--pytest.mark.skip-->

```bash
```bash { placeholders="DATABASE_NAME" }
influxdb3 create database --retention-period none DATABASE_NAME
```

Expand All @@ -101,7 +102,7 @@ Creates a database with a 90-day retention period using an authentication token.

<!--pytest.mark.skip-->

```bash
```bash { placeholders="AUTH_TOKEN|DATABASE_NAME" }
influxdb3 create database \
--retention-period 90d \
--token AUTH_TOKEN \
Expand All @@ -114,7 +115,7 @@ Creates a database with a 1-year retention period.

<!--pytest.mark.skip-->

```bash
```bash { placeholders="DATABASE_NAME" }
influxdb3 create database --retention-period 1y DATABASE_NAME
```

Expand All @@ -124,12 +125,10 @@ Creates a database with a retention period of 30 days and 12 hours.

<!--pytest.mark.skip-->

```bash
```bash { placeholders="DATABASE_NAME" }
influxdb3 create database --retention-period 30d12h DATABASE_NAME
```

{{% /code-placeholders %}}

## Retention period duration formats

Retention periods are specified as [duration](/influxdb3/version/reference/glossary/#duration)
Expand Down
Loading
Loading