[ckan-dev] Access package_id from resource_dict

Adrià Mercader adria.mercader at okfn.org
Mon Jul 29 15:26:21 UTC 2013


Hi Ryan,
Unfortunately there is not a direct link from resources to datasets,
as they are generally accessed the other way round.

Adrià

On 18 July 2013 01:16, Ryan Clark <ryan.clark at azgs.az.gov> wrote:
> I posted this on StackOverflow last week and got no love so I thought I'd
> try here.
>
> I'm looking for a way to find the package_id for a resource in CKAN. I
> access the resource via the resource_show action:
>
> resource_dict = toolkit.get_action("resource_show")(context, {"id":
> "my-resource"})
>
> The resulting dict does not tell me what package the resource belongs to. It
> does tell me:
>
> resource_dict.get("package_id", None) == None # <<< True
> resource_dict["resource_group_id"] = "some-uuid"
>
> And I can see in my database that a resource_group does have a package_id
> attribute. However, there doesn't seem to be a resource_group_show action.
>
> Is there another way for me to navigate from a resource dict to its parent
> package?
>
> Thanks!
>
> http://stackoverflow.com/questions/17603983/access-package-id-from-resource-dict-in-ckan
>
>
> ____________________
>
> Ryan Clark
> Arizona Geological Survey
> ryan.clark at azgs.az.gov
> (520) 302-4871
> facebook.com/ModernGeologist
> @worbly
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
>




More information about the ckan-dev mailing list