execute_query
Run SQL queries against InfluxDB databases and retrieve results in JSON, CSV, or other formats. Use COUNT(*) and LIMIT to handle large time-series datasets efficiently.
Instructions
Execute a SQL query against an InfluxDB database (all versions). Returns results in the specified format (defaults to JSON).
Large Dataset Warning: InfluxDB might contain massive time-series data. Always use COUNT(*) first to check size, then LIMIT/OFFSET for large results (>1000 rows).
Cloud Dedicated/Clustered & Cloud Serverless (v3) Requirements:
GROUP BY: Include all group columns in SELECT (e.g., SELECT place, COUNT(*) ... GROUP BY place)
Aggregations: Cast and alias COUNT (e.g., CAST(COUNT(*) AS DOUBLE) AS count)
Note: Both products require CAST for all aggregation functions (COUNT, SUM, AVG, MIN, MAX) to ensure results appear properly in response
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | SQL query to execute. | |
| format | No | Output format for query results | json |
| database | Yes | Name of the database/bucket to query |