Class: Ductr::Postgres::BufferedUpsertDestination

Inherits:
ETL::BufferedDestination
  • Object
show all
Defined in:
lib/ductr/postgres/buffered_upsert_destination.rb

Overview

A destination control that accumulates rows in a buffer to upsert them by batch, registered as :buffered_upsert. Accept the :buffer_size option, default value is 10 000:

destination :some_postgres_database, :buffered_upsert, buffer_size: 42 def my_destination(buffer, excluded, db) db[:items].insert_conflict(target: :id, update: excluded).multi_insert(buffer) end

See Also:

  • Ductr::ETL::BufferedDestination

Instance Method Summary collapse

Instance Method Details

#on_flushvoid

This method returns an undefined value.

Open the database if needed and call the job's method to run the query.



24
25
26
# File 'lib/ductr/postgres/buffered_upsert_destination.rb', line 24

def on_flush
  call_method(adapter.db, excluded, buffer)
end