pillar icon indicating copy to clipboard operation
pillar copied to clipboard

Stream read query

Open sonic182 opened this issue 2 years ago • 5 comments

The lib doesn't support read response as stream isn't it?

sonic182 avatar May 13 '22 08:05 sonic182

Yes, lib doesn't support this.

Is this supported via HTTP?

sofakingworld avatar May 13 '22 10:05 sofakingworld

Yes, when the server respond with headers Transfer-Encoding: chunked and then, the body is <chunk_size><chunk><chunk_size><chunk>.... See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding#examples

elixir Finch lib support this (uses Mint under the hood), with Finch.stream/5 method. I have use Finch because I needed to download clickhouse response in stream

HTTPoison supports async responses too but I don't recommend any use of HTTPoison because of hackney latest versions...

sonic182 avatar May 13 '22 14:05 sonic182

You can simplify this package A LOT by just using Finch, which already provides pool of conns

sonic182 avatar May 13 '22 15:05 sonic182

Right now we paused development of Pillar until September, in this way i advise you to make fork with branch https://github.com/balance-platform/pillar/pull/26 and add Finch HTTP Client

sofakingworld avatar May 17 '22 12:05 sofakingworld

With a stream if you need to query a lot of data to do processing on, you can do so without buffering everything first. I also need this and I think @sonic182 is right that Finch seems like a great option, as it does pooling out of the box and also supports streaming.

hkrutzer avatar Nov 24 '22 17:11 hkrutzer