[ckan-dev] Datastore error
Vitor Baptista
vitor at vitorbaptista.com
Fri Oct 10 02:35:27 UTC 2014
Hi Maurizio,
When you upload a file to CKAN, it's created on the Datastore. To avoid
that the data that exists on the Datastore becomes different than the data
of the original file, the Datastore throws this error when you try to call
datastore_create with a resource_id AND passing records. What you're trying
to do is updating the resource "2039e10a-869a-4da1-a909-0d8ac520f115"
adding these new records.
If that's really what you want to do, you need to send another parameter
"force": True, like:
curl -X POST http://127.0.0.1:5000/api/3/action/datastore_create -H
> "Authorization: 4d9c2123-5d25-4913-96ef-ac20cec1cf67" -d
> '{"resource_id": "2039e10a-869a-4da1-a909-0d8ac520f115", "fields": [
> {"id": "a"}, {"id": "b"} ], "records": [ { "a": 1, "b": "xyz"}, {"a": 2,
> "b": "zzz"} ], "force": True}
This part of the documentation needs to be improved.
Cheers,
2014-10-09 6:01 GMT-03:00 Maurizio "Graffio" Mazzoneschi <
graffio at lynxlab.com>:
> Hello,
> is there anyone that can help me to fix the error about datastore?
>
> I've installed from the source (github)
>
> This is how I test the datastore. I've followed the documentation in
> http://docs.ckan.org/en/latest/maintaining/datastore.html
> curl -X POST http://127.0.0.1:5000/api/3/action/datastore_create -H
> "Authorization: 4d9c2123-5d25-4913-96ef-ac20cec1cf67" -d
> '{"resource_id": "2039e10a-869a-4da1-a909-0d8ac520f115", "fields": [
> {"id": "a"}, {"id": "b"} ], "records": [ { "a": 1, "b": "xyz"}, {"a": 2,
> "b": "zzz"} ]}
>
> This is the error:
> error": {"__type": "Validation Error", "read-only": ["Cannot edit
> read-only resource. Either pass\"force=True\" or change url-type to
> \"datastore\"
>
> This is the result of "sudo -u postgres psql -l" after I've run paster
> --plugin=ckan datastore set-permissions -c
> /etc/ckan/default/development.ini | sudo -u postgres psql (I think there
> is a lack of information in documentation about how to set permissions,
> I've added -c /etc/ckan/default/development.ini otherwise it didn't work
> properly)
>
> List of databases
> Name | Owner | Encoding |
> Collate | Ctype | Access privileges
>
> -----------------------------+------------------+------------+------------+---------------+--------------------------------------------datastore_default
> | ckan_default | UTF8 | it_IT.UTF-8 | it_IT.UTF-8 |
> =Tc/ckan_default +
> | |
> | | |
> ckan_default=CTc/ckan_default +
> | |
> | | |
> datastore_default=c/ckan_default
>
> This is the settings in development.ini
> ckan.datastore.write_url =
> postgresql://ckan_default:ckan@localhost/datastore_default
> ckan.datastore.read_url =
> postgresql://datastore_default:ckan@localhost/datastore_default
>
> Of course I've add the plugin datastore in the development.ini
>
> It's two days that I try to fix the problem and I don't know what else I
> can do!
> thanks in advance
> m
>
>
> --
> maurizio "graffio" mazzoneschi
> Lynx s.r.l.
> http://www.lynxlab.com
> http://www.scoop.it/t/graffio
> skype: graffio_m
>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
--
Vítor Baptista
Developer | http://vitorbaptista.com | LinkedIn
<http://www.linkedin.com/in/vitorbaptista> | @vitorbaptista
<http://twitter.com/vitorbaptista>
The Open Knowledge Foundation <http://okfn.org>
*Empowering through Open Knowledge*
http://okfn.org/ | @okfn <http://twitter.com/okfn> | OKF on Facebook
<https://www.facebook.com/OKFNetwork> | Blog <http://blog.okfn.org/> |
Newsletter <http://okfn.org/about/newsletter/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20141009/dfd40c5b/attachment-0003.html>
More information about the ckan-dev
mailing list