dimcat.data.catalogs package#
Submodules#
dimcat.data.catalogs.base module#
- class dimcat.data.catalogs.base.DimcatCatalog(basepath: Optional[str] = None, packages: Optional[Union[Package, Package, str, List[Union[Package, Package, str]]]] = None)[source]#
Bases:
DataHas the purpose of collecting and managing a set of
Packageobjects.Analogous to a
frictionless.Catalog, but without intermediatefrictionless.Datasetobjects. Nevertheless, a DimcatCatalog can be stored as and created from a Catalog descriptor (ToDo).- class PickleSchema(*, only: Optional[Union[Sequence[str], AbstractSet[str]]] = None, exclude: Union[Sequence[str], AbstractSet[str]] = (), many: Optional[bool] = None, load_only: Union[Sequence[str], AbstractSet[str]] = (), dump_only: Union[Sequence[str], AbstractSet[str]] = (), partial: Optional[Union[bool, Sequence[str], AbstractSet[str]]] = None, unknown: Optional[Literal['exclude', 'include', 'raise']] = None)[source]#
Bases:
PickleSchema- exclude: set[Any] | MutableSet[Any]#
- unknown: types.UnknownOption#
- class Schema(*, only: Optional[Union[Sequence[str], AbstractSet[str]]] = None, exclude: Union[Sequence[str], AbstractSet[str]] = (), many: Optional[bool] = None, load_only: Union[Sequence[str], AbstractSet[str]] = (), dump_only: Union[Sequence[str], AbstractSet[str]] = (), partial: Optional[Union[bool, Sequence[str], AbstractSet[str]]] = None, unknown: Optional[Literal['exclude', 'include', 'raise']] = None)[source]#
Bases:
PickleSchema,Schema- exclude: set[Any] | MutableSet[Any]#
- unknown: types.UnknownOption#
- add_package(package: Union[Package, Package, str], basepath: Optional[str] = None, copy: bool = False)[source]#
Adds a
Packageto the catalog.
- add_resource(resource: Resource, package_name: Optional[str] = None)[source]#
Adds a resource to the catalog. If package_name is given, adds the resource to the package with that name.
- check_feature_availability(feature: Union[Feature, Type[Feature], DimcatConfig, MutableMapping, FeatureName, str]) bool[source]#
Checks whether the given feature is potentially available.
- extend(catalog: Iterable[Package]) None[source]#
Adds all packages from another catalog to this one.
- extend_package(package: Package) None[source]#
Adds all resources from the given package to the existing one with the same name.
- get_package(name: Optional[str] = None) Package[source]#
If a name is given, calls
get_package_by_name(), otherwise returns the last loaded package.- Raises:
RuntimeError if no package has been loaded. –
- get_package_by_name(name: str, create: bool = False) Package[source]#
- Raises:
fl.FrictionlessException if none of the loaded packages has the given name. –
- get_resource_by_config(config: DimcatConfig) Resource[source]#
Returns the first resource that matches the given config.
- Raises:
EmptyCatalogError – If the package is empty.
NoMatchingResourceFoundError – If no resource matching the specs is found in the “features” package.
- get_resource_by_name(name: str) R[source]#
Returns the Resource with the given name.
- Raises:
EmptyCatalogError – If the package is empty.
ResourceNotFoundError – If the resource with the given name is not found.
- get_resources_by_regex(regex: str) List[Resource][source]#
Returns the Resource objects whose names contain the given regex.
- get_resources_by_type(resource_type: Union[Type[Resource], str]) List[Resource][source]#
Returns the Resource objects of the given type.
- has_package(name: str) bool[source]#
Returns True if a package with the given name is loaded, False otherwise.
- make_new_package(package: Optional[Union[Package, Package, str]] = None, package_name: Optional[str] = None, basepath: Optional[str] = None, auto_validate: bool = False)[source]#
Adds a package to the catalog. Parameters are the same as for
Package.
dimcat.data.catalogs.inputs module#
- class dimcat.data.catalogs.inputs.InputsCatalog(basepath: Optional[str] = None, packages: Optional[Union[Package, Package, str, List[Union[Package, Package, str]]]] = None)[source]#
Bases:
DimcatCatalog- extract_feature(feature: Union[Feature, Type[Feature], DimcatConfig, MutableMapping, FeatureName, str]) F[source]#
Extracts the given features from all packages and combines them in a Feature resource.
- get_feature(feature: Union[Feature, Type[Feature], DimcatConfig, MutableMapping, FeatureName, str]) F[source]#
ToDo: Get features from all packages and merge them.
dimcat.data.catalogs.outputs module#
- class dimcat.data.catalogs.outputs.OutputsCatalog(basepath: Optional[str] = None, packages: Optional[Union[Package, Package, str, List[Union[Package, Package, str]]]] = None)[source]#
Bases:
DimcatCatalog- get_feature(feature: Optional[Union[Feature, Type[Feature], DimcatConfig, MutableMapping, FeatureName, str]] = None) F[source]#
Looks up the given feature in the “features” package and returns it.
- Raises:
PackageNotFoundError – If no package with the name “features” is loaded.
NoMatchingResourceFoundError – If no resource matching the specs is found in the “features” package.