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: Data

Has the purpose of collecting and managing a set of Package objects.

Analogous to a frictionless.Catalog, but without intermediate frictionless.Dataset objects. 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

dump_fields: dict[str, Field]#
exclude: set[Any] | MutableSet[Any]#
fields: dict[str, Field]#

Dictionary mapping field_names -> Field objects

load_fields: dict[str, Field]#
opts: Any = <marshmallow.schema.SchemaOpts object>#
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

dump_fields: dict[str, Field]#
exclude: set[Any] | MutableSet[Any]#
fields: dict[str, Field]#

Dictionary mapping field_names -> Field objects

load_fields: dict[str, Field]#
opts: Any = <marshmallow.schema.SchemaOpts object>#
unknown: types.UnknownOption#
add_package(package: Union[Package, Package, str], basepath: Optional[str] = None, copy: bool = False)[source]#

Adds a Package to 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.

property basepath: Optional[str]#

If specified, the basepath for all packages added to the catalog.

check_feature_availability(feature: Union[Feature, Type[Feature], DimcatConfig, MutableMapping, FeatureName, str]) bool[source]#

Checks whether the given feature is potentially available.

copy() Self[source]#
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:
get_resource_by_name(name: str) R[source]#

Returns the Resource with the given name.

Raises:
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.

iter_resources()[source]#

Iterates over all resources in all packages.

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.

property package_names: List[str]#
property packages: List[Package]#
replace_package(package: Package) None[source]#

Replaces the package with the same name as the given package with the given package.

summary_dict(include_type: bool = True) dict[source]#

Returns a summary of the dataset.

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.

get_metadata() Metadata[source]#

Returns a dataframe with all metadata.

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:
iter_resources() Iterator[Tuple[str, DimcatResource]][source]#

Iterates over all resources in all packages.

Yields:

The package name and the resource.

Module contents#