Giter Club home page Giter Club logo

Comments (5)

aerosol avatar aerosol commented on May 26, 2024 1

Livebook smart cell :)

from ch.

hkrutzer avatar hkrutzer commented on May 26, 2024 1

Streaming the results of queries would be great. I think it requires setting the connection mode to active though.

from ch.

ruslandoga avatar ruslandoga commented on May 26, 2024 1

Streaming the results of queries would be great. I think it requires setting the connection mode to active though.

There is an undocumented Ch.stream function that is used in the benchmarks. It doesn't decode the raw data into rows very well yet (right now it only does the decoding if :types option is provided).

Here's a minimal example:

{:ok, pid} = Ch.start_link()

Ch.run(pid, fn conn ->
  conn
  |> Ch.stream("select number from system.numbers limit {limit:UInt64}", %{"limit" => 1_000_000}, types: ["UInt64"]) 
  |> Stream.each(fn rows -> IO.puts("at #{Time.utc_now()} got #{length(List.flatten(rows))} rows") end)
  |> Stream.run()
end)
at 13:24:49.737616 got 2560 rows
at 13:24:49.742150 got 36864 rows
at 13:24:49.752535 got 50657 rows
at 13:24:49.760068 got 51169 rows
at 13:24:49.765942 got 50688 rows
at 13:24:49.771635 got 51169 rows
at 13:24:49.776692 got 50657 rows
at 13:24:49.782096 got 51169 rows
at 13:24:49.787199 got 50657 rows
at 13:24:49.792197 got 51200 rows
at 13:24:49.797056 got 50657 rows
at 13:24:49.802442 got 51169 rows
at 13:24:49.807619 got 50657 rows
at 13:24:49.812214 got 51200 rows
at 13:24:49.816771 got 50657 rows
at 13:24:49.821738 got 51169 rows
at 13:24:49.826986 got 51169 rows
at 13:24:49.831561 got 50657 rows
at 13:24:49.836822 got 51200 rows
at 13:24:49.841795 got 50657 rows
at 13:24:49.846984 got 44018 rows

And some tests.

from ch.

ruslandoga avatar ruslandoga commented on May 26, 2024 1

@hkrutzer yeah, most likely. We'd "just" need to decode types from RowBinaryWithNamesAndTypes and store them in the accumulator.

from ch.

hkrutzer avatar hkrutzer commented on May 26, 2024

That's great! Will it support not having to specify types in the future?

from ch.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.