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!


Select your region

Linux Package Signing Key Rotation

All signed InfluxData Linux packages have been resigned with an updated key. If using Linux, you may need to update your package configuration to continue to download and verify InfluxData software packages.

For more information, see the Linux Package Signing Key Rotation blog post.

InfluxDB Cloud backed by InfluxDB IOx

All InfluxDB Cloud organizations created on or after January 31, 2023 are backed by the new InfluxDB IOx storage engine. Check the right column of your InfluxDB Cloud organization homepage to see which InfluxDB storage engine you’re using.

If powered by IOx, this is the correct documentation.

If powered by TSM, see the TSM-based InfluxDB Cloud documentation.

InfluxDB Cloud backed by InfluxDB TSM

All InfluxDB Cloud organizations created on or after January 31, 2023 are backed by the new InfluxDB IOx storage engine which enables nearly unlimited series cardinality and SQL query support. Check the right column of your InfluxDB Cloud organization homepage to see which InfluxDB storage engine you’re using.

If powered by TSM, this is the correct documentation.

If powered by IOx, see the IOx-based InfluxDB Cloud documentation.

State of the InfluxDB Cloud (IOx) documentation

The new documentation for InfluxDB Cloud backed by InfluxDB IOx is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.