Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access package_id from resource dict in CKAN

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!

like image 306
Ryan Clark Avatar asked Nov 02 '22 18:11

Ryan Clark


1 Answers

In CKAN 2.3 and newer, package_id is returned in the call to the resource_show API call.

like image 181
Denis Avatar answered Nov 11 '22 08:11

Denis