'Insert data from SQL file in Django DB
I'm working on a Django Project, and I have all my datas in .sql files. I want to insert all of them in my Database. Can I use the python shell to do it ? Or should I use another method ?
Solution 1:[1]
If you have file or can convert your data into csv or xml then you can make a script which iterate through your data file and then store each data into variable and as per your Django model fields and then you can bulk_create
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Hemal Patel |