Catalog is a set of data packages.
We can create a catalog providing a list of data packages:
from frictionless import Catalog, Dataset, Package
catalog = Catalog(datasets=[Dataset(name='name', package=Package('tables/*'))])
Usually Catalog is used to describe some external set of datasets like a CKAN instance or a Github user or search. For example:
from frictionless import Catalog
catalog = Catalog('https://demo.ckan.org/dataset/')
print(catalog)
The core purpose of having a catalog is to provide an ability to have a set of datasets. The Catalog class provides useful methods to manage datasets:
from frictionless import Catalog
catalog = Catalog('https://demo.ckan.org/dataset/')
catalog.dataset_names
catalog.has_dataset
catalog.add_dataset
catalog.get_dataset
catalog.clear_datasets
As any of the Metadata classes the Catalog class can be saved as JSON or YAML:
from frictionless import Package
catalog = Catalog('https://demo.ckan.org/dataset/')
catalog.to_json('datacatalog.json') # Save as JSON
catalog.to_yaml('datacatalog.yaml') # Save as YAML
Catalog representation
(*, source: Optional[Any] = None, control: Optional[Control] = None, name: Optional[str] = None, title: Optional[str] = None, description: Optional[str] = None, datasets: List[Dataset] = NOTHING, basepath: Optional[str] = None) -> None
# TODO: add docs
Optional[Any]
# TODO: add docs
Optional[Control]
A short url-usable (and preferably human-readable) name. This MUST be lower-case and contain only alphanumeric characters along with “.”, “_” or “-” characters.
Optional[str]
Type of the object
ClassVar[Union[str, None]]
A Catalog title according to the specs. It should be a human-oriented title of the resource.
Optional[str]
A Catalog description according to the specs. It should be a human-oriented description of the resource.
Optional[str]
A list of datasets. Each package in the list is a Data Dataset.
List[Dataset]
A basepath of the catalog. The normpath of the resource is joined `basepath` and `/path`
Optional[str]
Return names of datasets
List[str]
Add new dataset to the catalog
(dataset: Union[Dataset, str]) -> Dataset
Remove all the datasets
Dereference underlaying metadata If some of underlaying metadata is provided as a string it will replace it by the metadata object
Get dataset by name
(name: str) -> Dataset
Check if a dataset is present
(name: str) -> bool
Infer catalog's metadata
(*, stats: bool = False)
Remove dataset by name
(name: str) -> Dataset
Set dataset by name
(dataset: Dataset) -> Optional[Dataset]
Create a copy of the catalog
(**options: Any)
Dataset representation.
(*, name: str, title: Optional[str] = None, description: Optional[str] = None, package: Union[Package, str], basepath: Optional[str] = None, catalog: Optional[Catalog] = None) -> None
A short url-usable (and preferably human-readable) name. This MUST be lower-case and contain only alphanumeric characters along with “.”, “_” or “-” characters.
str
A short name(preferably human-readable) for the Check. This MUST be lower-case and contain only alphanumeric characters along with "-" or "_".
ClassVar[str]
A human-readable title for the Check.
Optional[str]
A detailed description for the Check.
Optional[str]
# TODO: add docs
Union[Package, str]
# TODO: add docs
Optional[str]
# TODO: add docs
Optional[Catalog]
Dereference underlaying metadata If some of underlaying metadata is provided as a string it will replace it by the metadata object
Infer dataset's metadata
(*, stats: bool = False)