Potential work around is:

ins = DB[table_name.to_sym].insert_ignore.with_sql(:insert_sql, [:cola, 
:colb, table_stamp.to_sym], dataset).insert

It generates a INSERT IGNORE but not sure if there's a better way.

On Monday, 1 June 2015 11:27:19 UTC+1, Ian Winter wrote:
>
> I've got the following block:
>
>     dataset = DB[:old_table].
>       select(:cola, :colb, :colc).
>       where(:cold => ratings[$options[:type].to_sym].to_i).
>       where(:colc => Time.at(range_start)..(Time.at(range_end)))
>     ins = DB[table_name.to_sym].with_sql(:insert_sql, [:cola, :colb, 
> table_stamp.to_sym], dataset).update_ignore.update
>
> And a subsequent 
>
>   rescue Sequel::UniqueConstraintViolation => e
>
> Now I thought that'd stop dupe key errors, but, it doesn't. Is the 
> with_sql stopping that?
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to