Documentation

Manage DBRP mappings

InfluxQL requires a database and retention policy (DBRP) combination in order to query data. In InfluxDB Cloud, databases and retention policies have been combined and replaced by InfluxDB buckets. To query InfluxDB Cloud with InfluxQL, the specified DBRP combination must be mapped to a bucket.

Automatic DBRP mapping

InfluxDB Cloud will automatically create DBRP mappings for you during the following operations:

For more information, see Database and retention policy mapping.

Create DBRP mappings

Use the influx CLI or the InfluxDB API to create DBRP mappings.

A DBRP combination can only be mapped to a single bucket

Each unique DBRP combination can only be mapped to a single bucket. If you map a DBRP combination that is already mapped to another bucket, it will overwrite the existing DBRP mapping.

Use the influx v1 dbrp create command to map an unmapped bucket to a database and retention policy. Include the following:

* Required

  • * org and token to authenticate. We recommend setting your organization and token to your active InfluxDB connection configuration in the influx CLI, so you don’t have to add these parameters to each command. To set up your active InfluxDB configuration, see influx config set.
  • * database name to map
  • * retention policy name to map
  • * Bucket ID to map to
  • Default flag to set the provided retention policy as the default retention policy for the database
influx v1 dbrp create \
  --db example-db \
  --rp example-rp \
  --bucket-id 00oxo0oXx000x0Xo \
  --default

Use the /api/v2/dbrps API endpoint to create a new DBRP mapping.

POST http://localhost:8086/api/v2/dbrps

Include the following:

  • Request method: POST
  • Headers:
    • Authorization: Token schema with your InfluxDB API token
    • Content-type: application/json
  • Request body: JSON object with the following fields:
    * Required
    • * bucketID: bucket ID
    • * database: database name
    • default: set the provided retention policy as the default retention policy for the database
    • * org or orgID: organization name or organization ID
    • * retention_policy: retention policy name
curl --request POST http://localhost:8086/api/v2/dbrps \
  --header "Authorization: Token YourAuthToken" \
  --header 'Content-type: application/json' \
  --data '{
        "bucketID": "00oxo0oXx000x0Xo",
        "database": "example-db",
        "default": true,
        "orgID": "00oxo0oXx000x0Xo",
        "retention_policy": "example-rp"
      }'

List DBRP mappings

Use the influx CLI or the InfluxDB API to list all DBRP mappings and verify the buckets you want to query are mapped to a database and retention policy.

Use the influx v1 dbrp list command to list DBRP mappings.

The examples below assume that your organization and API token are provided by the active InfluxDB connection configuration in the influx CLI. If not, include your organization (--org) and API token (--token) with each command.

View all DBRP mappings
influx v1 dbrp list
Filter DBRP mappings by database
influx v1 dbrp list --db example-db
Filter DBRP mappings by bucket ID
influx v1 dbrp list --bucket-id 00oxo0oXx000x0Xo

Use the /api/v2/dbrps API endpoint to list DBRP mappings.

GET http://localhost:8086/api/v2/dbrps

Include the following:

  • Request method: GET
  • Headers:
    • Authorization: Token schema with your InfluxDB API token
  • Query parameters:
    * Required
    • * orgID: organization ID
    • bucketID: bucket ID (to list DBRP mappings for a specific bucket)
    • database: database name (to list DBRP mappings with a specific database name)
    • rp: retention policy name (to list DBRP mappings with a specific retention policy name)
    • id: DBRP mapping ID (to list a specific DBRP mapping)
View all DBRP mappings
curl --request GET \
  http://localhost:8086/api/v2/dbrps?orgID=00oxo0oXx000x0Xo \
  --header "Authorization: Token YourAuthToken"
Filter DBRP mappings by database
curl --request GET \
  http://localhost:8086/api/v2/dbrps?orgID=00oxo0oXx000x0Xo&db=example-db \
  --header "Authorization: Token YourAuthToken"
Filter DBRP mappings by bucket ID
curl --request GET \
  https://cloud2.influxdata.com/api/v2/dbrps?organization_id=00oxo0oXx000x0Xo&bucketID=00oxo0oXx000x0Xo \
  --header "Authorization: Token YourAuthToken"

Update a DBRP mapping

Use the influx CLI or the InfluxDB API to update a DBRP mapping.

Use the influx v1 dbrp update command to update a DBRP mapping. Include the following:

* Required

  • * org and token to authenticate. We recommend setting your organization and token to your active InfluxDB connection configuration in the influx CLI, so you don’t have to add these parameters to each command. To set up your active InfluxDB configuration, see influx config set.
  • * DBRP mapping ID to update
  • Retention policy name to update to
  • Default flag to set the retention policy as the default retention policy for the database
Update the default retention policy
influx v1 dbrp update \
  --id 00oxo0X0xx0XXoX0
  --rp example-rp \
  --default

Use the /api/v2/dbrps/{dbrpID} API endpoint to update DBRP mappings.

PATCH http://localhost:8086/api/v2/dbrps/{dbrpID}

Include the following:

* Required

  • Request method: PATCH
  • Headers:
    • * Authorization: Token schema with your InfluxDB API token
  • Path parameters:
    • * id: DBRP mapping ID to update
  • Query parameters:
  • Request body (JSON):
    • rp: retention policy name to update to
    • default: set the retention policy as the default retention policy for the database
Update the default retention policy
curl --request PATCH \
  http://localhost:8086/api/v2/dbrps/00oxo0X0xx0XXoX0?orgID=00oxo0oXx000x0Xo \
  --header "Authorization: Token YourAuthToken"
  --data '{
      "rp": "example-rp",
      "default": true
    }'

Delete a DBRP mapping

Use the influx CLI or the InfluxDB API to delete a DBRP mapping.

Use the influx v1 dbrp delete command to delete a DBRP mapping. Include the following:

* Required

  • * org and token to authenticate. We recommend setting your organization and token to your active InfluxDB connection configuration in the influx CLI, so you don’t have to add these parameters to each command. To set up your active InfluxDB configuration, see influx config set.
  • * DBRP mapping ID to delete
influx v1 dbrp delete --id 00oxo0X0xx0XXoX0

Use the /api/v2/dbrps/{dbrpID} API endpoint to delete a DBRP mapping.

DELETE http://localhost:8086/api/v2/dbrps/{dbrpID}

Include the following:

* Required

  • Request method: PATCH
  • Headers:
    • * Authorization: Token schema with your InfluxDB API token
  • Path parameters:
    • * id: DBRP mapping ID to update
  • Query parameters:
curl --request DELETE \
  http://localhost:8086/api/v2/dbrps/00oxo0X0xx0XXoX0?orgID=00oxo0oXx000x0Xo \
  --header "Authorization: Token YourAuthToken"

Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Read more

InfluxDB v3 enhancements and InfluxDB Clustered is now generally available

New capabilities, including faster query performance and management tooling advance the InfluxDB v3 product line. InfluxDB Clustered is now generally available.

InfluxDB v3 performance and features

The InfluxDB v3 product line has seen significant enhancements in query performance and has made new management tooling available. These enhancements include an operational dashboard to monitor the health of your InfluxDB cluster, single sign-on (SSO) support in InfluxDB Cloud Dedicated, and new management APIs for tokens and databases.

Learn about the new v3 enhancements


InfluxDB Clustered general availability

InfluxDB Clustered is now generally available and gives you the power of InfluxDB v3 in your self-managed stack.

Talk to us about InfluxDB Clustered

InfluxDB Cloud powered by TSM