Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom fields can't be created from API #158

Closed
mouillerart opened this issue Jun 20, 2017 · 5 comments
Closed

Custom fields can't be created from API #158

mouillerart opened this issue Jun 20, 2017 · 5 comments

Comments

@mouillerart
Copy link

Hello,

I made a custom schema with a "language" field for datasets. The field can be filled using the GUI and read with package_show, but when I try to create or update it using API (package_create / package_update), CKAN does not accept the field (although it accepts all standard CKAN fields).

Is it a missing feature, like automatically integrating a new scheme in package_dict ?

@ted-strauss-K1
Copy link

Having exactly the same issue.
I'm using ckanapi extension as API interface.

@wardi
Copy link
Contributor

wardi commented Feb 7, 2018

no, new fields get added to the API like the other fields. Can you post a small example schema that demonstrates the issue?

@ted-strauss-K1
Copy link

ted-strauss-K1 commented Feb 8, 2018

Here is the schema "bids_meg": https://gist.github.com/tedstrauss/5d5e305faadcc22bf9fce7010a7be2e9
(Details about what this schema is representing: link)
Here is the metadata being imported: https://gist.github.com/tedstrauss/dd8f0f4486e7a2be2842f8f27aced03b
Call to ckanapi:
> (start virtual env)
> ckanapi load datasets -I import_this_dataset.json -c /etc/ckan/default/development.ini

The package is created on the CKAN instance, but none of the special fields of the schema are added.
Do I need to specify the type in the JSON somewhere?

Here is the output on the command line:

/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py:79: SAWarning: Usage of the 'related attribute set' operation is not currently supported within the execution stage of the flush process. Results may not be consistent.  Consider using alternative event listeners or connection-level operations instead.
  sess._flush_warning("related attribute set")
1 [None] --- create None "abcdefghv1002e"

@wardi
Copy link
Contributor

wardi commented Feb 8, 2018

Yes, you need to use "type": "bids_meg" in your dataset or the default schema will apply instead of the one you defined.

@ted-strauss-K1
Copy link

ted-strauss-K1 commented Feb 8, 2018

That worked! Thanks.
I was using "dataset_type": "bids_meg"
Next step, get the same fields represented in LOD with DCAT: ckan/ckanext-dcat#56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants