Typorithm · medium

influx query

influx-query-cliinfluxdbfluxcliquery
Saved on this device
Full lesson · 8 learning steps Open any exercise for focused practice
1

Step 1 of 8 · intro card

Learn influx query

0%

Buckets & InfluxQL

influx query runs Flux from the CLI — inline as a quoted string or from a file with -f.

The influx query command executes Flux against your InfluxDB, either as inline text or from a saved file.

Inline, you quote the whole script: from(bucket:"metrics") |> range(start:-1h) selects a bucket and filters the last hour.

For longer or version-controlled scripts, -f query.flux runs the Flux stored in a file.

01

influx query runs Flux from the CLI.

02

Inline scripts go in single quotes.

03

-f runs a Flux file.

influx query 'from(bucket:"metrics") |> range(start:-1h)'
influx query -f query.flux

Read the implementation

Connect each part of the code to the concept before you type.

1. Inline Flux

influx query runs a Flux script passed inline as a quoted argument.

influx query 'from(bucket:"metrics") |> range(start:-1h)'

2. Flux source

from(bucket:"metrics") starts the Flux pipeline by selecting a bucket.

from(bucket:"metrics")

3. Pipe to range

|> pipes the table into range(), which filters to the last hour.

|> range(start:-1h)

4. Run from file

-f runs the Flux script stored in a file instead of inline text.

influx query -f query.flux

A complete learning loop

01

Understand

Read the concept map and follow the code breakdown.

02

Reconstruct

Type the implementation, repair mistakes and work through every recall exercise.

03

Verify

Use the final check without hints; revisit weak concepts in short practice sessions.

influx query: Lesson & Practice · Typorithm | ApplyDjinn