influxdb-rs / influxdb-rust

Rust Client for the InfluxDB Time Series Database
https://crates.io/crates/influxdb
MIT License
256 stars 78 forks source link

How to write a set of data in one query? #110

Closed youngzhaozju closed 7 months ago

youngzhaozju commented 2 years ago

Hi, Thanks for the nice project. I want to write some series of data in a time, but I found the client.query() can handel only a series record a time. Is there any way to write may records in a time? Thank you! Regards, Yang

deeprobin commented 2 years ago

I am also interested in a solution for this. /cc @msrd0

Empty2k12 commented 2 years ago

Feel free to open a PR which adds batch inserting. Should not be very hard to implement.

sdether commented 2 years ago

I'm also looking for bulk writing of lines and I'd be interested in providing a PR, but i'm not sure I read the terminology in this library correctly. It looks like client.query() with a WriteQuery hits the /write endpoint. Does that mean that a WriteQuery.get produces a line protocol from an InfluxDbWriteable? If so would a reasonable interface for bulk inserts look like a new BulkWriteQuery which can be constructed from an iterable of InfluxDbWriteable and itself contains an iterable of WriteQuery so that it can then generate a post body of line feed separated line protocols? Thx.

sdether commented 2 years ago

Ok, never mind. v0.5.2 already has support for Vec<WriteQuery> as a query type for client.query(). Looking at the code, this was added in #87 back on 3/6/21. I just tested the code and it works, so this issue should be closed, unless I mis-read the request.

Empty2k12 commented 2 years ago

Ah, right. Maybe you can update the Readme Supported Features and add it there?

sdether commented 2 years ago

Updated: #112

Empty2k12 commented 7 months ago

Closing this, as the README has been updated in #112 to document the bulk write capacity.