Home > other >  Questions about django data import
Questions about django data import

Time:11-20

I want to bulk import data in a CSV file, could you tell me what should I do?

CodePudding user response:

I don't know your level of python, because you have to start learning Django supposedly python is higher than the entry level, at least intermediate, integrated by the level of people ask import CSV will let people have a little can't understand,

Have a ready-made library don't have to write code directly implement import CSV django - csvimport and django - adaptors

Import CSV data usually written code is simple,
A way is to direct call database interface over the Django ORM directly import Model corresponding database table, this is belong to the knowledge of Python primer,

Another way is to initialize the Django ORM, reference Model, each row CSV data instance into a Model instance, append to a list
With the Model. Finally bulk_import bulk import list,

CodePudding user response:

Can't send some reference code, please
  • Related