[ckan-dev] Relationship between resource and datastore
Lasse Vestergaard
ibbernik at gmail.com
Wed Jan 2 11:07:41 UTC 2013
Hi again.
> This was also how I thought it, but how do I *only* use the datastore? I
> > might be misinterpreting you, but aren't you saying that I can have a
> > datastore as a resource? This way I don't need to upload a CSV file, and
> I
> > can just create a datastore with a specifik structure? Or do you just
> mean
> > that I shouldn't use the CSV file I uploaded?
>
> To be honest, there is no clean way at the moment. You will need to create
> a new resource with a temporary url and then create the datastore table
> manually through the API. Then change the url to point to the datastore (or
> a url that points to the converter that returns CSV). In this case you
> won't need the original CSV file but you will have to do a lot of things
> manually.
> Alternatively, you can add the original resource as a CSV, let the
> datastorer import it and then change the url of the resource in the
> datastore. The second option will have the advantage, that the data will
> already be in the datastore and is probably the preferred option.
>
I have been looking into this, and there are some things I don't
understand. I get the first, of the above solutions, but the latter seems
impossible to do. The problem already arises when I create a new CSV
resource. It seems that the datastorer won't import the CSV file because
there is no existing datastore. This makes perfect sense, as I perceive it,
because a datastore is always "owned" by a resource, according to the
documentation (you need a resource id to create a datastore). This means
that it doesn't make sense that the datastorer tries to update a datastore
with data from the CSV file - there is not yet created any datastore
because the resource has not been created until now.
Furthermore I can't change the url of the resource in the datastore. There
is only registered an id of the resource in the datastore (and that is the
name of the table, as I perceive it). When a resource has been created,
then I can't change it - I cannot change a link resource to an uploaded
file, so that I can use the same resource id.
Thanks in advance.
Lasse
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20130102/42dcfe7c/attachment.html>
More information about the ckan-dev
mailing list