ibridges.search.search_data

ibridges.search.search_data(session, path=None, checksum=None, key_vals=None)

Search for collections, data objects and metadata.

By default all accessible collections and data objects are returned. It is also possible to find items with specific metadata, using wild cards. The wildcard used in the iRODS universe is %, not *.

Parameters:
  • session (Session) – Session to search with.

  • path (str) – (Partial) path or IrodsPath

  • checksum (str) – (Partial) checksum

  • key_vals (dict) – Attribute name mapping to values.

Raises:

ValueError: – If no search criterium is supplied.

Return type:

list[dict]

Returns:

List of dictionaries with keys: COLL_NAME (absolute path of the collection), DATA_NAME (name of the data object), D_DATA_CHECKSUM (checksum of the data object) The latter two keys are only present of the found item is a data object.

Examples

>>> # Find all sub collections and data objects for a path
>>> search_data(session, path="/path/to/sub/col/%")
>>> # Find all data objects with a specific checksum
>>> search_data(session, checksum="...")
>>> # Find data objects and collections with some key/value pair.
>>> search_data(session, key_vals={"some_key": "some_value"})