Documentation

Use the influxdb3 CLI to query data

InfluxDB 3 Enterprise is in Public Alpha

InfluxDB 3 Enterprise is in public alpha and available for testing and feedback, but is not meant for production use. Both the product and this documentation are works in progress. We welcome and encourage your input about your experience with the alpha and invite you to join our public channels for updates and to share feedback.

Alpha expectations and recommendations

Use the influxdb3 query command to query data in InfluxDB 3 Enterprise with SQL or InfluxQL.

Provide the following with your command:

  • Database name: The name of the database to query. Provide this using one of the following:

    • -d, --database command option
    • INFLUXDB3_DATABASE_NAME environment variable
  • Query language (Optional): The query language of the query. Use the -l, --language option to specify one of the following query languages:

    • sql (default)
    • influxql
  • Query: SQL or InfluxQL query string to execute.

influxdb3 query \
  --database 
DATABASE_NAME
\
"SELECT * FROM home"
influxdb3 query \
  --database 
DATABASE_NAME
\
--language influxql \ "SELECT * FROM home"

In the examples above and below, replace the following:

  • DATABASE_NAME: Name of the database to query

Output format

The influxdb3 query command supports the following output formats:

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

influxdb3 query \
  --database 
DATABASE_NAME
\
--format json \ "SELECT * FROM home WHERE time >= '2022-01-01T08:00:00Z' LIMIT 5"

View example pretty-formatted results

View example JSON-formatted results

View example JSON-line-formatted results

View example CSV-formatted results

Output query results to a Parquet file

To output query results to a Parquet file, provide the following options with the influxdb3 query command:

  • --format: parquet
  • -o, --output: the filepath to the Parquet file to store results in
influxdb3 query \
  --database 
DATABASE_NAME
\
--format parquet \ --output path/to/results.parquet \ "SELECT * FROM home WHERE time >= '2022-01-01T08:00:00Z' LIMIT 5"

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 3 Open Source Now in Public Alpha

InfluxDB 3 Open Source is now available for alpha testing, licensed under MIT or Apache 2 licensing.

We are releasing two products as part of the alpha.

InfluxDB 3 Core, is our new open source product. It is a recent-data engine for time series and event data. InfluxDB 3 Enterprise is a commercial version that builds on Core’s foundation, adding historical query capability, read replicas, high availability, scalability, and fine-grained security.

For more information on how to get started, check out: