Skip to content

Did column meta

Classes

DidColumnMeta

DidColumnMeta()

A metadata plugin to interact with the base DID table metadata.

Initialize the DID column metadata plugin.

Functions

get_metadata
get_metadata(scope, name, *, session)

Get all the metadata of some data identifier.

PARAMETER DESCRIPTION
scope

The scope of the DID.

TYPE: InternalScope

name

The name of the DID.

TYPE: str

session

The database session in use.

TYPE: Session

RETURNS DESCRIPTION
dict[str, Any]

DID metadata as a dictionary.

set_metadata
set_metadata(
    scope, name, key, value, recursive=False, *, session
)

Add a single key-value metadata pair to a data identifier.

PARAMETER DESCRIPTION
scope

The scope of the DID.

TYPE: InternalScope

name

The name of the DID.

TYPE: str

key

The metadata key.

TYPE: str

value

The metadata value.

TYPE: Any

recursive

Option to propagate the metadata updates to child content.

TYPE: bool DEFAULT: False

session

The database session in use.

TYPE: Session

set_metadata_bulk
set_metadata_bulk(
    scope, name, metadata, recursive=False, *, session
)

Add multiple key-value metadata pairs to a data identifier.

PARAMETER DESCRIPTION
scope

The scope of the DID.

TYPE: InternalScope

name

The name of the DID.

TYPE: str

metadata

All key-value metadata pairs to set.

TYPE: dict[str, Any]

recursive

Option to propagate the metadata updates to child content.

TYPE: bool DEFAULT: False

session

The database session in use.

TYPE: Session

list_dids
list_dids(
    scope,
    filters,
    did_type="collection",
    ignore_case=False,
    limit=None,
    offset=None,
    long=False,
    recursive=False,
    ignore_dids=None,
    *,
    session
)

Search data identifiers.

:yields: - If long is False: DID names (str). - If long is True: dicts with keys: {'scope', 'name', 'did_type', 'bytes', 'length'}.

PARAMETER DESCRIPTION
scope

The scope of the DIDs to list.

TYPE: InternalScope

filters

A single dict or a list of dicts representing OR groups (disjunction). Each group can include a semantic 'type' expanded into did_type filters.

TYPE: Union[dict[str, Any], list[dict[str, Any]]]

did_type

Option to filter by a specific DID type: all(container, dataset, file), collection(dataset or container), dataset, container, file.

TYPE: Literal['all', 'collection', 'dataset', 'container', 'file'] DEFAULT: 'collection'

ignore_case

Has no effect.

TYPE: bool DEFAULT: False

limit

Option to limit the number of returned results.

TYPE: Optional[int] DEFAULT: None

offset

Has no effect.

TYPE: Optional[int] DEFAULT: None

long

Option to display more information for each DID.

TYPE: bool DEFAULT: False

recursive

Option to recursively list child-DIDs content.

TYPE: bool DEFAULT: False

ignore_dids

A set of 'scope:name' strings to de-duplicate results across OR groups and recursion.

TYPE: Optional[set[str]] DEFAULT: None

session

The database session in use.

TYPE: Session

delete_metadata
delete_metadata(scope, name, key, *, session=None)

Deletes the metadata stored for the given key. (Currently not implemented)

PARAMETER DESCRIPTION
scope

The scope of the DID.

TYPE: InternalScope

name

The name of the DID.

TYPE: str

key

Key of the metadata.

TYPE: str

session

The database session in use.

TYPE: Optional[Session] DEFAULT: None

manages_key
manages_key(key, *, session=None)

Return whether a metadata key is managed by this plugin.

PARAMETER DESCRIPTION
key

Key of the metadata.

TYPE: str

session

Unused; accepted for interface compatibility.

TYPE: Optional[Session] DEFAULT: None

RETURNS DESCRIPTION
bool

True if the key is managed by this plugin, else False.

get_plugin_name
get_plugin_name()

Return a unique identifier for this plugin.

RETURNS DESCRIPTION
str

The name of the plugin.

Functions