Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def bulk_insert_copyfrom(cursor, table_name, field_names, values):
- if not values: return
- #print "bulk copy from prepare..."
- str_vals = "n".join("t".join(adapt_to_str(val) for val in cur_vals) for cur_vals in values)
- strf = StringIO(str_vals)
- #print "bulk copy from execute..."
- cursor.copy_from(strf, table_name, columns=tuple(field_names))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement