Class: Ductr::Postgres::StreamedSource

Inherits:
ETL::Source
  • Object
show all
Defined in:
lib/ductr/postgres/streamed_source.rb

Overview

A source control that yields rows usnig the PostgreSQL streaming feature, registered as :streamed:

source :some_postgres_database, :streamed def select_some_stuff(db) db[:items].limit(42) end

You can select a large number of rows, without worrying about pagination handling or memory usage.

Instance Method Summary collapse

Instance Method Details

#each { ... } ⇒ void

This method returns an undefined value.

Opens the database, calls the job's method and iterate over the query results.

Yields:

  • The each block



25
26
27
# File 'lib/ductr/postgres/streamed_source.rb', line 25

def each(&)
  call_method(adapter.db).each(&)
end