api.catalog#

class datagen.api.catalog.impl.AssetCatalog(asset_type: Type[Asset], asset_attributes_type: Type[AssetAttributes], asset_id_to_asset_attrs: dict, hooks: List[AssetCreationHook[Asset]] = [])#

Do not access this class directly!

Access this class only through one of the instances listed in DatagenAssetsCatalog.__init__().

count(**attributes) int#

Queries the catalog for the number of assets matching a certain request.

The category of assets that are counted is determined by the catalog you are accessing, which is determined by the AssetCatalog instance that you used when accessing this function. For example:

For the list of available asset catalogs, see DatagenAssetsCatalog.__init__().

Parameters:

attributes (Any) – Optional. A dictionary of attributes that you can use to filter the catalog.

Returns:

The number of assets in the catalog matching your query.

Return type:

int

get(id: Optional[str] = None, limit: Optional[int] = None, **attributes) Union[Asset, List[Asset], Dict[str, AssetAttributes], AssetAttributes]#

Gets assets from the asset catalog.

The type of Asset object you get is determined by the instance of AssetCatalog that you used when accessing this function. For example:

For a reference table of available asset catalogs and their relevant types, see DatagenAssetsCatalog.__init__.

Parameters:
  • id (str) – Optional. Returns a single Asset matching the chosen UUID.

  • limit (int) –

    Optional. Caps the number of Assets that will be included in the response.

    • If limit=1, returns a single Asset object.

    • If limit>1, returns an object of type List[Asset] (even if there is only one matching asset in the list).

  • attributes (Any) – Optional. A dictionary of attributes that you can use to filter the catalog.

Returns:

The asset or assets that match your search query

Return type:

  • List[Asset] in the form of a lazy list

  • Asset when limit=1 or when an id is provided

The list of asset catalogs#

datagen.api.catalog.impl.DatagenAssetsCatalog.__init__()#

This function is run automatically on import and defines the list of catalog types that you can use in conjunction with the datagen.api.catalog.impl.AssetCatalog.get() and datagen.api.catalog.impl.AssetCatalog.count() functions.

Parameters: