influxdb-rust icon indicating copy to clipboard operation
influxdb-rust copied to clipboard

How to write a set of data in one query?

Open youngzhaozju opened this issue 3 years ago • 6 comments

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

youngzhaozju avatar Mar 15 '22 03:03 youngzhaozju

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

deeprobin avatar May 28 '22 10:05 deeprobin

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

Empty2k12 avatar May 28 '22 10:05 Empty2k12

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 avatar Jun 09 '22 17:06 sdether

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.

sdether avatar Jun 15 '22 17:06 sdether

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

Empty2k12 avatar Jun 15 '22 18:06 Empty2k12

Updated: #112

sdether avatar Jun 15 '22 19:06 sdether

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

Empty2k12 avatar Apr 04 '24 14:04 Empty2k12