[ckan-dev] CKAN and CSVKIT (was: Re: path of uploaded resource in filestorage?)

Maurizio "Graffio" Mazzoneschi graffio at lynxlab.com
Wed Oct 8 20:52:12 UTC 2014


Hallo,
I'm going on with the integration of upload of a csv file with csvkit.

So, about where the file uploaded is stored, I have discovered (sorry if
I'm boring you) that the id of the resource establishes the path of the
file.
So a resource with id 5f090a10-45d6-4ebb-a2ed-db016e2b3f15 has this path
<ckan.storage_path>/5f0/90a/10-45d6-4ebb-a2ed-db016e2b3f15

Isn't it?

The code, obviously not yet completed and really "dirty", is on github:
https://github.com/lynxlab/ckanext-oaks

good night
m


Il 06/10/2014 19:13, Maurizio "Graffio" Mazzoneschi ha scritto:
> Hello all,
> Is there any way to know which is the file path of an uploaded file in
> the file-store?
>
> I'm writing a plugin that make the operator life more easy: I would like
> convert xls in csv directly.
> But I don't know how get the physical path to the file uploded.
>
> Anyone can help me?
>
> I've seen that in the Hard Disk I've this file:
> /var/lib/ckan/default/resources/5f0/90a/10-45d6-4ebb-a2ed-db016e2b3f15
>
> it correspond to this URL to it:
> http://127.0.0.1:5000/dataset/test-be1/resource/5f090a10-45d6-4ebb-a2ed-db016e2b3f15
>
> I understand that I can isolate the last part of the URL in this way:
> * 5f0 (first 3 chars = directory 5f0 inside the dir resources)
> * 90a (second 3 chars = directory 90a inside the dir resources/5f0)
> * 10-45d6-4ebb-a2ed-db016e2b3f15 the name of the file
>
> Is this always true?
> Are always 3 chars?
>
> There is others more easy ways to identify the absolute path of the
> resource file?
> thanks in advance
>
> Thanks in advance
> m
>


-- 
maurizio "graffio" mazzoneschi
Lynx s.r.l.
http://www.lynxlab.com
http://www.scoop.it/t/graffio
skype: graffio_m





More information about the ckan-dev mailing list