Query data with InfluxQL
Use the InfluxDB 1.x
/query compatibility endpoint
to query data in InfluxDB 2.0 with InfluxQL.
The InfluxDB 1.x compatibility API supports
all InfluxDB 1.x client libraries and integrations in InfluxDB 2.0.
Provide the following:
- InfluxDB authentication token (See compatibility API authentication)
- db query parameter: 1.x database to query
- rp query parameter: 1.x retention policy to query
- q query parameter: InfluxQL query
URL-encode the InfluxQL query to ensure it’s formatted correctly when submitted to InfluxDB.
curl -G https://cloud2.influxdata.com/query?db=db&rp=rp \ -H "Authorization: Token YourAuthToken" \ --data-urlencode "q=SELECT used_percent FROM mem WHERE host=host1"
By default, the
/query compatibility endpoint returns results in JSON.
To return results as CSV, include the
Accept: application/csv header.
Database and retention policy mapping
InfluxDB 2.0 combines the 1.x concept of databases and retention policies into buckets. To support InfluxDB 1.x query and write patterns in InfluxDB 2.0, databases and retention policies are mapped to buckets using the database and retention policy (DBRP) mapping service. See DBRP mapping for more information.
InfluxQL in InfluxDB 2.0 supports read-only queries (with two exceptions shown below).
Supported InfluxQL queries
SHOW TAG KEYS
SHOW TAG VALUES
SHOW FIELD KEYS
* These commands delete data.
Unsupported InfluxQL queries
Use the InfluxDB 2.0 UI, CLI, and API to perform the following actions:
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, the following resources are available:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.