Source code for tdw_catalog.metadata.linked_dataset

from typing import Optional
from tdw_catalog.utils import MetadataFieldType
import tdw_catalog.dataset as dataset
import tdw_catalog.metadata.field as field

from typing import TYPE_CHECKING
if TYPE_CHECKING:
    import tdw_catalog.dataset as dataset


[docs]class Field(field.MetadataField[dataset.Dataset]): """ Connect :class:`.Dataset`\\ s together to maintain lineage or increase discoverability Attributes ---------- None """ def __init__(self, key: str, value: Optional['dataset.Dataset']) -> None: super().__init__(key, value) def serialize(self) -> dict: res = super().serialize() res["value"] = self.value.id if self.value is not None else None res["field_type"] = MetadataFieldType.FT_DATASET return res