コード例 #1
0
class AddDatasetPropertiesConfig(ConfigModel):
    add_properties_resolver_class: Type[AddDatasetPropertiesResolverBase]

    class Config:
        arbitrary_types_allowed = True

    _resolve_properties_class = pydantic_resolve_key("add_properties_resolver_class")
コード例 #2
0
class AddDatasetTermsConfig(ConfigModel):
    # Workaround for https://github.com/python/mypy/issues/708.
    # Suggested by https://stackoverflow.com/a/64528725/5004662.
    get_terms_to_add: Union[Callable[[DatasetSnapshotClass],
                                     List[GlossaryTermAssociationClass]],
                            Callable[[DatasetSnapshotClass],
                                     List[GlossaryTermAssociationClass]], ]

    _resolve_term_fn = pydantic_resolve_key("get_terms_to_add")
コード例 #3
0
class AddDatasetOwnershipConfig(ConfigModel):
    # Workaround for https://github.com/python/mypy/issues/708.
    # Suggested by https://stackoverflow.com/a/64528725/5004662.
    get_owners_to_add: Union[Callable[[DatasetSnapshotClass],
                                      List[OwnerClass]],
                             Callable[[DatasetSnapshotClass],
                                      List[OwnerClass]], ]
    default_actor: str = builder.make_user_urn("etl")

    _resolve_owner_fn = pydantic_resolve_key("get_owners_to_add")
コード例 #4
0
class AddDatasetOwnershipConfig(ConfigModel):
    # Workaround for https://github.com/python/mypy/issues/708.
    # Suggested by https://stackoverflow.com/a/64528725/5004662.
    get_owners_to_add: Union[
        Callable[[DatasetSnapshotClass], List[OwnerClass]],
        Callable[[DatasetSnapshotClass], List[OwnerClass]],
    ]
    default_actor: str = builder.make_user_urn("etl")
    semantics: Semantics = Semantics.OVERWRITE

    _resolve_owner_fn = pydantic_resolve_key("get_owners_to_add")

    @validator("semantics", pre=True)
    def ensure_semantics_is_upper_case(cls, v):
        if isinstance(v, str):
            return v.upper()
        return v