Open eldobbins opened 1 month ago
Looks like ckanext-scheming does some validation with the 'extras' field, but ckanext-dcat gets rid of that field. We were able to patch the problem by adding a try-except block around lines 283-289 in ckanext-scheming/ckanext/scheming/plugins.py, as follows:
if action_type == 'show':
if composite_convert_fields:
try:
for ex in data_dict['extras']:
if ex['key'] in composite_convert_fields:
data_dict[ex['key']] = json.loads(ex['value'])
data_dict['extras'] = [
ex for ex in data_dict['extras']
if ex['key'] not in composite_convert_fields
]
except:
print('Dataset has no extras field.')
Probably not the most graceful fix, but if there's no 'extras' field then that chunk of code won't be doing anything anyways.
@eldobbins thanks for the detailed report
However, we can't seem to have both simultaneously.
Yes, absolutely. Ckanext-dcat should work perfectly fine alongside datastore and datapusher/xloader/etc. If it doesn't it's a bug
I managed to reproduce it on my end. Took me a while as I didn't realize I was running CKAN 2.11 as opposed to 2.10 as you reported, so that's a good clue. Let me investigate a bit more. The solution might be handling it in ckanext-scheming as @jematson suggests but I want to understand why this is happening first.
scheming kaks because of a missing field
Really love the sound of this, maybe I'll start using it!
I tracked down the issue to this patch https://github.com/ckan/ckan/pull/7571 not being backported to CKAN 2.10. This is now backported so the next 2.10 patch release (and the Docker images that will get updated with it) will include the patch and fix this issue.
In parallel I also sent a PR to ckanext-scheming with a fix similar to @jematson 's one for good measure. That should also be in the next scheming release.
In the meantime you can apply the patch manually.
We are developing a small catalog and have plans to include both DataStore uploads for table views and DCAT metadata fields. However, we can't seem to have both simultaneously.
I am running CKAN 2.10 installed with ckan-docker on a local machine (http://localhost:5000). My machine:
Linux shell 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
but same problem on Windows.The plugin set-up from ckan.ini is copied from the dcat docs:
The error happens when I attempt to upload a resource (small CSV file) to DataStore using the button in the GUI catalog. It works fine if we upload the CSV using the API. The traceback of the docker container is:
Apologies for the interleaved messages from the various containers. Looks to me like scheming kaks because of a missing field
extras
which then causes datapusher to fail, which then triggers a 500 error within the catalog. Can I avoid this error with a different set of options?Thanks, Liz