Thanks, Jeremy. I made this work as below, learning in the way some Ruby
syntax. My way went brutal but will work for now, I need to trace how the
actual inserts implemented and get some permanence metrics. I have a
question. The #multi_insert use json that assures the constancy of
delimiters. The #import takes Chr(39) encoded values. As you see in my code
I build it dynamically from my json but on the SQL side it is basically a
string. So, if any of my values have single quote then I presume I need to
escape it but as I tested it works for some reasons. I did not look into
your code but did you have the single quote provision built in already?
chunk.msgpack_each{|tag, time, data|
paylod << JSON.parse(data)
num += 1
}
paylod.each do |key, value|
sqlvalues = key.values
sqlkeys = key.keys
end
s_sql = "'" + sqlvalues.join("','") + "'"
a_sqlvalues =
s_sql.split(",")
columslist = sqlkeys.map { |x| x.to_sym }
begin
client[@table.to_sym].import(columslist, [a_sqlvalues])
ensure
client.disconnect
end
$log.info "Inserted record: #{num}"
--
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 https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.