Sequel, , Ruby- , , .
, Sequel, :
- : SELECT col1, col2, col3 = > [val1, val2, val3] hash {: col1 = > val1...}
Try:
DB[:table].filter([:col1, :col2, :col3].zip([1, 2, 3]))
, API :
DB[:table].bfilter([:col1, :col2, :col3], [1, 2, 3])
- /, : select (array_of_columns) (not: dataset.select(: col1,: col2,: col3), , )
Try:
array_of_columns = [:col1, :col2, :col3]
DB[:table].select(*array_of_columns)
- API "some_schema.some_table" ( ) ; ( )
:
DB[:schema__table]
DB[:table.qualify(:schema)]
, , . , . , , , .
:
DB[:table].columns
:
DB.schema(:table)
# [[:col1=>{:type=>:integer, :db_type=>'int(11)', :default=>nil, ...}], ...]
: type - ruby: db_type - .
, - :
DB[:table].each do |row|
DB[:other_table].insert(:blah=>row[:blah])
end
Sequel - : other_table, : select on table. , :
DB = Sequel.connect(..., :servers=>{:read_only=>{}})
DB[:table].each do |row|
DB[:other_table].insert(:blah=>row[:blah])
end
: read_only shard select : : other_table. :
DB[:table].server(:read_only).each do |row|
DB[:other_table].server(:default).insert(:blah=>row[:blah])
end
, , , , Sequel . , , , Sequel , , Ruby- .