Gorm: Support bulk inserts of a slice of objects

Created on 7 Aug 2014  路  4Comments  路  Source: go-gorm/gorm

I'm using gorm to populate my DB with a bunch of info from a file. It would be awesome, for performance reasons, if I could insert a whole slice with one INSERT SQL statement.

Most helpful comment

+1 I am doing something similar by parsing a CSV of records.

All 4 comments

+1 I am doing something similar by parsing a CSV of records.

I don't like this idea because it won't run callbacks, and save associations...

I can imagine many people will misuse this feature when have it. So maybe better write your own sql to do this job?

@jinzhu for Postgres, which uses positional arguments rather than ? for inserts, how do you recommend we build the bulk insert statement?

@calebthompson have a look at python/django orm, they already have this feature

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rfyiamcool picture rfyiamcool  路  3Comments

superwf picture superwf  路  3Comments

koalacxr picture koalacxr  路  3Comments

sredxny picture sredxny  路  3Comments

leebrooks0 picture leebrooks0  路  3Comments