Class: DBA::Pull

Inherits:
Command show all
Defined in:
lib/dba/pull.rb

Instance Attribute Summary

Attributes inherited from Command

#database, #table_name

Instance Method Summary collapse

Methods inherited from Command

arity_check, #initialize

Constructor Details

This class inherits a constructor from DBA::Command

Instance Method Details

#call(table, url) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/dba/pull.rb', line 2

def call(table, url)
  self.table_name = table

  dataset = database[table_name]

  other_database = Sequel.connect(url)

  database.transaction do
    other_database[table_name].each { |row| dataset.insert(row) }
  end
end