Re: Bulk import of data
heya,
Hmm, I was previously under the impression that for these sorts of things (importing and instantiating models from CSV), the recommended way to create a ModelForm, and pass each line of the CSV through that, and have that handle model validation for you.
In our case, we have a CSV file, but quite a few of those lines are probably invalid/erroneous - we need to provide useful messages on those, and import the rest of the file.
Is the recommended way now to use bulk_create (https://docs.djangoproject.com/en/dev/ref/models/querysets/#bulk-create), process all the lines, and hit that in one call?
How would you handle invalid lines or validation errors for individual rows?
Cheers,
Victor
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/qYfAZWsydQoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home