Class: Ductr::SequelBase::PaginatedSource
- Inherits:
-
ETL::PaginatedSource
- Object
- ETL::Control
- ETL::Source
- ETL::PaginatedSource
- Ductr::SequelBase::PaginatedSource
- Defined in:
- lib/ductr/sequel_base/paginated_source.rb
Overview
A source control that allows to select a big number of rows by relying on pagination.
Instance Attribute Summary
Attributes inherited from ETL::Control
#adapter, #job_method, #options
Instance Method Summary collapse
-
#each_page { ... } ⇒ Boolean
Calls the job’s method and iterate on the query result.
Methods inherited from ETL::PaginatedSource
Methods inherited from ETL::Source
Methods inherited from ETL::Control
Constructor Details
This class inherits a constructor from Ductr::ETL::Control
Instance Method Details
#each_page { ... } ⇒ Boolean
Calls the job’s method and iterate on the query result. Returns true if the page is full, false otherwise.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ductr/sequel_base/paginated_source.rb', line 18 def each_page(&) rows_count = 0 call_method(adapter.db, @offset, page_size).each do |row| yield(row) rows_count += 1 end if rows_count > page_size raise InconsistentPaginationError, "The query returned #{rows_count} rows but the page size is #{page_size} rows" end rows_count == page_size end |