Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: influx query should have an option to dump the raw flux response #19254

Closed
russorat opened this issue Aug 7, 2020 · 1 comment · Fixed by #19433
Closed

cli: influx query should have an option to dump the raw flux response #19254

russorat opened this issue Aug 7, 2020 · 1 comment · Fixed by #19433

Comments

@russorat
Copy link
Contributor

russorat commented Aug 7, 2020

as a user, i would like to use the influx query command to dump data from one bucket and load it into another. right now, the influx query command formats the output to display in the terminal, with no option to write the raw flux response.

the influx write -f export.csv command expects the raw annotated csv returned by the /query api.

Adding an option to print the raw flux response would allow users to run the following commands:

influx query 'from(bucket: "telegraf") |> range(start: -1h)' > results.csv
influx write -f results.csv -b new_bucket
@nathanielc nathanielc added this to the Sprint 20-Q3-5 milestone Aug 11, 2020
@russorat
Copy link
Contributor Author

Today, you can move data between instances using curl and the influx write command, like so:

curl http://localhost:9999/api/v2/query\?org\=influxdata -XPOST -sS \
  -H 'Authorization: Token my_token' \
  -H 'Accept: application/csv' \
  -H 'Content-type: application/json' \
  -d '{
  "dialect": {
    "annotations": [
      "group",
      "datatype",
      "default"
    ]
  },
  "query": "from(bucket:\"write_test\") |> range(start: -100y)"
}' | influx write -b csv_test --format csv

After this issue is complete, we should be able to do something like this:
influx query --raw 'from(bucket: "telegraf") |> range(start: -1h)' | influx write -b new_bucket --format csv

I'm not sure if there should be a way to specify the annotations as part of this or not. i think the default should include group, datatype, and default though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants