ODM2 / ODM2PythonAPI

A set of Python functions that provides data read/write access to an ODM2 database by leveraging SQLAlchemy.
http://odm2.github.io/ODM2PythonAPI/
BSD 3-Clause "New" or "Revised" License
4 stars 13 forks source link

createDataSet fails to create dataset #21

Closed Castronova closed 5 years ago

Castronova commented 8 years ago

The createDataset function in createService.py fails.

from odm2api.ODM2.services.createService import CreateODM2
writer = CreateODM2(my_local_connection)
writer = ReadODM2(self.connection)
myDataset = writer.createDataset(dstype='my dataset',
                                 dscode='my_dataset',
                                 dstitle='this is my dataset'
                                 dsabstract='some description')

IntegrityError: (IntegrityError) NOT NULL constraint failed: Datasets.DatasetUUID u'INSERT INTO datasets (datasetuuid, datasettypecv, datasetcode, datasettitle, datasetabstract) VALUES (?, ?, ?, ?, ?)' (None, None, None, None, 'test')

The createDataset function sets values for the following variables DatasetTypeCV, DatasetCode, DatasetTitle, DatasetAbstract, DatasetUUID. However, these variables do not exist in the models.py DataSets class, instead they are named **DataSet***.

To fix, change the variables that are set in createService.createDataset to match the variables defined in models.DataSets

emiliom commented 5 years ago

This issue is ancient. Before closing it (it's probably worth closing just by virtue of it being so old ...), I tried to see if the problem described here no longer exists. That definitely seems to be the case:

So, I'm calling this resolved and closing the issue.