metacat_utils

Utility functions for interacting with the MetaCat web API.

class merge_utils.metacat_utils.MetaCatRetriever(query: str | None = None, filelist: list | None = None)[source]

Class for managing asynchronous queries to the MetaCat web API.

Initialize the MetaCatRetriever with a query or a list of files.

Parameters:
  • query – MQL query to find files

  • filelist – list of file DIDs to find

async connect() None[source]

Connect to the MetaCat web API

async input_batches() AsyncGenerator[dict, None][source]

Asynchronously retrieve metadata for the next batch of files.

Returns:

dict of MergeFile objects that were added

merge_utils.metacat_utils.list_extensions() list[source]

Get a list of all file extensions in the MetaCat database.

Returns:

list of file extensions

merge_utils.metacat_utils.list_field_values(field: str) list[source]

Get a list of all values for a given field in the MetaCat database.

Parameters:

field – field to query

Returns:

list of values for the field