Sha256: a58696a6c887a4ff3e88eb69e21ad0fa1d80a6bdaeee5cffa13b322401e18973
Contents?: true
Size: 767 Bytes
Versions: 1
Compression:
Stored size: 767 Bytes
Contents
module PostgresUpsert module ReadAdapters class ActiveRecordAdapter def initialize(source, options) @options = sanitize_options(options) @source = source end def sanitize_options(options) options.slice( :columns, :map, :unique_key ) end def continuous_write_enabled false end def gets(&block) batch_size = 1_000 line = "" conn = @source.connection.raw_connection conn.copy_data("COPY #{@source.table_name} TO STDOUT") do while (line_read = conn.get_copy_data) do line << line_read end end yield line end def columns @source.column_names end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
postgres_upsert-5.1.0 | lib/postgres_upsert/read_adapters/active_record_adapter.rb |