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

influx non-interactive mode - INSERT must be handled #5078

Closed
marinonjalsson opened this issue Dec 9, 2015 · 7 comments
Closed

influx non-interactive mode - INSERT must be handled #5078

marinonjalsson opened this issue Dec 9, 2015 · 7 comments
Labels
difficulty/medium Resolving this issue should take up to a week
Milestone

Comments

@marinonjalsson
Copy link

if I try to insert measurement though non-interactive mode like:

influx -database measure -execute 'INSERT sensor,floor=1 value=2'
ERR: error parsing query: found INSERT, expected SELECT, DELETE, SHOW, CREATE, DROP, GRANT, REVOKE, ALTER, SET at line 1, char 1

Where is the insert function non-interactive mode?

version:

 influx -version
InfluxDB shell 0.9.6

Marinó

@otoolep otoolep added status/help-wanted difficulty/medium Resolving this issue should take up to a week labels Dec 10, 2015
@otoolep
Copy link
Contributor

otoolep commented Dec 10, 2015

Thanks for the report @marinonjalsson

What is most likely happening here is that INSERT is not a real keyword. Instead it is intercepted by the CLI and converted into a write query. The CLI code should be updated to check for that in non-interactive mode.

Marking this as "help-wanted" as it should not be too difficult for someone who would like to help out with the source.

In the meantime, you know you can insert data via curl, right? That will get you exactly the same thing (it's basically what the CLI would do).

@otoolep otoolep changed the title influx non-interactive mode - no INSERT ! influx non-interactive mode - INSERT must be handled Dec 10, 2015
@grange74
Copy link
Contributor

I'd like to try fixing this. I've looked at code and can see where this is happening.
I just want to confirm the expected behaviour is to allow inserts in non-interactive mode just like it does for interactive mode?
Also does it need to support multiple insert statements?

@gunnaraasen
Copy link
Member

@grange74 That seems like expected behavior. I think the following changes could significantly improve the CLI's non-interactive feature.

  • Make the non-interactive mode send everything through the CLI's parser the same way the interactive mode works.
  • Add options to execute non-interactive mode so that it does not use the CLI's parser, e.g. -execute-write and -execute-query.
  • Add multiline support to all non-interactive mode options.

A PR for any of the above would be greatly appreciated.

@otoolep
Copy link
Contributor

otoolep commented Dec 15, 2015

@gunnaraasen -- I don't see the point of the second idea. Can you explain why one would want that?

@gunnaraasen
Copy link
Member

If -execute goes through the CLI parser, then a file containing a bunch of line protocol points would need to have INSERT appended to every line. An -execute-write option would not use the CLI's parser, e.g. it would be equivalent to curl. Maybe -execute-raw-write would be a better name for that option.

@otoolep
Copy link
Contributor

otoolep commented Dec 15, 2015

I see.

Yeah, that could be handy.

@grange74
Copy link
Contributor

Thanks, i'll have a go at the first idea. It makes a lot of sense.
For other two, i'll see if i get time, i'm assuming they should probably be separate PRs.

otoolep added a commit that referenced this issue Dec 17, 2015
Fixed #5078 to support Inserts in non-interactive mode.
@jwilder jwilder added this to the 0.10.0 milestone Feb 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/medium Resolving this issue should take up to a week
Projects
None yet
Development

No branches or pull requests

5 participants