content/chronograf/v1/guides/write-to-influxdb.md
Use Chronograf to write data to InfluxDB. Choose from the following methods:
INTO clause in a queryto() function in a querySelect {{< icon "data-explorer" "v2" >}} Explore in the left navigation bar.
Click Write Data in the top right corner of the Data Explorer.
{{< img-hd src="/img/chronograf/1-9-write-data.png" alt="Write data to InfluxDB with Chronograf" />}}
Select the database (if an InfluxQL data source is selected) or database and retention policy (if a Flux data source is selected) to write to.
{{< img-hd src="/img/chronograf/1-9-write-db-rp.png" alt="Select database and retention policy to write to" />}}
Select one of the following methods for uploading line protocol:
Select the timestamp precision of your line protocol. Chronograf supports the following units:
s (seconds)ms (milliseconds)u (microseconds)ns (nanoseconds){{< img-hd src="/img/chronograf/1-9-write-precision.png" alt="Select write precision in Chronograf" />}}
Click Write.
INTO clause in a queryTo write data back to InfluxDB with an InfluxQL query, include the
INTO clause
in your query:
Select {{< icon "data-explorer" "v2" >}} Explore in the left navigation bar.
Select InfluxQL as your data source type.
Write an InfluxQL query that includes the INTO clause. Specify the database,
retention policy, and measurement to write to. For example:
SELECT *
INTO "mydb"."autogen"."example-measurement"
FROM "example-db"."example-rp"."example-measurement"
GROUP BY *
Click Submit Query.
{{% note %}}
To use InfluxQL to write to an InfluxDB 2.x or InfluxDB Cloud instance, configure database and retention policy mappings and ensure the current InfluxDB connection includes the appropriate connection credentials. {{% /note %}}
to() function in a queryTo write data back to InfluxDB with an InfluxQL query, include the
INTO clause
in your query:
Select {{< icon "data-explorer" "v2" >}} Explore in the left navigation bar.
Select Flux as your data source type.
{{% note %}} To query InfluxDB with Flux, enable Flux in your InfluxDB configuration. {{% /note %}}
Write an Flux query that includes the to() function.
Provide the database and retention policy to write to.
Use the db-name/rp-name syntax:
from(bucket: "example-db/example-rp")
|> range(start: -30d)
|> filter(fn: (r) => r._measurement == "example-measurement")
|> to(bucket: "mydb/autogen")
Click Run Script.