Sha256: d232661ab00d1a2c302e0872a20d08d28255d8834e9b86adbfa7b876bd5d9959

Contents?: true

Size: 760 Bytes

Versions: 11

Compression:

Stored size: 760 Bytes

Contents

require 'duckdb'

DuckDB::Result.use_chunk_each = true
DuckDB::Database.open do |db|
  db.connect do |con|
    con.query('SET threads=1')
    con.query('CREATE TABLE tbl as SELECT range a, mod(range, 10) b FROM range(10000)')
    con.query('CREATE TABLE tbl2 as SELECT range a, mod(range, 10) b FROM range(10000)')
    # con.query('SET ENABLE_PROGRESS_BAR=true')
    # con.query('SET ENABLE_PROGRESS_BAR_PRINT=false')
    pending_result = con.async_query('SELECT * FROM tbl where b = (SELECT min(b) FROM tbl2)')

    # con.interrupt
    while pending_result.state == :not_ready
      pending_result.execute_task
      print '.'
      $stdout.flush
      sleep 0.01
    end
    result = pending_result.execute_pending
    puts
    p result.each.first
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
duckdb-1.0.0.2 sample/async_query.rb
duckdb-1.0.0.1 sample/async_query.rb
duckdb-1.0.0.0 sample/async_query.rb
duckdb-0.10.2.0 sample/async_query.rb
duckdb-0.10.1.1 sample/async_query.rb
duckdb-0.10.1.0 sample/async_query.rb
duckdb-0.10.0.0 sample/async_query.rb
duckdb-0.9.2.3 sample/async_query.rb
duckdb-0.9.2.2 sample/async_query.rb
duckdb-0.9.2.1 sample/async_query.rb
duckdb-0.9.2 sample/async_query.rb