Sha256: 7c5834d183aa03ff9cf97e6f8f90ed8aca10a07a956fe9e441b34b673a79240c
Contents?: true
Size: 889 Bytes
Versions: 2
Compression:
Stored size: 889 Bytes
Contents
# frozen_string_literal: true module Ductr module SequelBase # # A destination control that accumulates rows in a buffer to upsert them by batch. # class BufferedUpsertDestination < Ductr::ETL::BufferedDestination # # Open the database if needed and call the job's method to run the query. # # @return [void] # def on_flush call_method(adapter.db, excluded, buffer) end private # # Generate the excluded keys hash e.g. # # ```ruby # {a: Sequel[:excluded][:a]} # ``` # # @return [Hash<Symbol, Sequel::SQL::QualifiedIdentifier>] The excluded keys hash # def excluded keys = buffer.first.keys excluded_keys = keys.map do |key| Sequel[:excluded][key] end keys.zip(excluded_keys).to_h end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ductr-0.2.3 | lib/ductr/sequel_base/buffered_upsert_destination.rb |
ductr-0.2.2 | lib/ductr/sequel_base/buffered_upsert_destination.rb |