Catalogue#
- class dscat.index.Catalogue(engine)[source]#
A connection to the SQLite catalogue index.
Wraps a SQLAlchemy engine and an open connection, and exposes typed write and read helpers over the declarative schema in this module. Open one with
open(), then build the schema on a fresh database withinit_schema().- classmethod open(path, create=False)[source]#
Open the catalogue at
path.- Parameters:
path (
pathlib.Path) – Path to the SQLite index file.create (
bool, defaultFalse) – WhenTrue, create a fresh database, replacing any existing file. WhenFalse, raise if the file does not exist.
- Returns:
An open catalogue.
- Return type:
- Raises:
FileNotFoundError – When
createisFalseand no index exists atpath.
- upsert_version(dataset, version, ship_folder, dictionary_path)[source]#
Insert or replace a version row, stamping the current ingest time.
- clear_dataset(dataset)[source]#
Delete every version, table, feature, and document row for a dataset.
- insert_documents(rows)[source]#
Bulk-insert document rows from
(dataset, version, path, kind, title)tuples.