schematools.contrib.django.loaders module

class schematools.contrib.django.loaders.DatabaseSchemaLoader(*args, **kwargs)

Bases: SchemaLoader

A schema loader that retrieves datasets that are imported into the Django database.

When objects are directly retrieved using Dataset.objects.get(), there is no linking of schemas between different schema’s. This loader interface makes sure schema’s can resolve their relations by fetching the relevant definitions from the database.

__init__(*args, **kwargs)
get_all_datasets(enable_db=None) dict[str, schematools.types.DatasetSchema]

Retrieve all datasets from the database storage

get_dataset(dataset_id: str, prefetch_related: bool = False) DatasetSchema

Retrieve a single dataset from the database storage.

get_table(dataset: DatasetSchema, table_ref) DatasetTableSchema

Datasets have their tables inlined, so there is no need to support this either.