data-importer

“Upload” a file from django shell

[亡魂溺海] 提交于 2019-12-30 01:12:48
问题 I need to import some data from a excel file and a folder with images, every row in the excel describes every entry and have a list of filenames in the folder (photos related to the entry). I've done a script which creates every entry in the database and saves it trough the django shell, but i have no idea how to instantiate a InMemoryUploadedFile for save it with the model. In django 1.0 I had this small class which allowed me to do what i need, but with changes in django 1.1 it's not

“Upload” a file from django shell

放肆的年华 提交于 2019-11-30 04:58:55
I need to import some data from a excel file and a folder with images, every row in the excel describes every entry and have a list of filenames in the folder (photos related to the entry). I've done a script which creates every entry in the database and saves it trough the django shell, but i have no idea how to instantiate a InMemoryUploadedFile for save it with the model. In django 1.0 I had this small class which allowed me to do what i need, but with changes in django 1.1 it's not working any more. class ImportFile(file): def __init__(self, *args, **kwargs): super(ImportFile, self).__init

How to import initial data to database with Hibernate?

99封情书 提交于 2019-11-26 08:58:31
问题 When deploying applications, I often use Hibernate’s capacity to create database schema in order to simplify the deployment. This is easily achievable by configuring hibernate.hbm2ddl.auto property. However, on occasion I also need to insert some initial data to database, for example root user. Is there a way I could achieve this via hibernate with some kind of load textual file? I know I could easily program the code that will do so, but just wondering if there is already some utility that

How to import initial data to database with Hibernate?

懵懂的女人 提交于 2019-11-26 07:17:12
问题 When deploying applications, I often use Hibernate’s capacity to create database schema in order to simplify the deployment. This is easily achievable by configuring hibernate.hbm2ddl.auto property. However, on occasion I also need to insert some initial data to database, for example root user. Is there a way I could achieve this via hibernate with some kind of load textual file? I know I could easily program the code that will do so, but just wondering if there is already some utility that