NAME

bi-extract - build the extracts of Database::BI's accelerated datasets

SYNOPSIS

bi-extract --spec <spec> [--spec <spec> ...]
bi-extract --all
bi-extract --remove --spec <spec>
bi-extract --list
options: [--data-dir <dir>] [--model-dir <dir>]

DESCRIPTION

An accelerated dataset is read from a SQLite copy of itself, an extract, for as long as the extract still matches the file it was built from. This marks a dataset accelerated and builds its extract, rebuilds every accelerated dataset's extract, or stops accelerating one, and prints what it did.

An extract is a cache under <model_dir>/extracts/, or under database-bi-extracts/ in the cache directory when one is set: cache_dir through Object::Configure (or Database__BI__Extract__cache_dir), then $ENV{CACHEDIR}, then $ENV{CACHE_DIR}, then cache_dir in database_bi.conf. Deleting that folder loses nothing: the application reads each file again until this is rerun. Nothing is ever written under data_dir. Run it from the application's folder, or give --data-dir and --model-dir.

Suitable for cron, after the data files are refreshed:

15 2 * * * cd /opt/myapp && bi-extract --all

OPTIONS

--spec, -s spec

Accelerate a dataset and build its extract: table:name in data_dir, or path:/abs/file. Repeatable.

--all, -a

Rebuild the extract of every accelerated dataset.

--remove, -r

With --spec: stop accelerating it, and remove its extract.

--list, -l

Print the accelerated datasets.

--data-dir, -d dir

The data folder (default: the application's, usually data).

--model-dir, -m dir

The model store folder (default: the application's, usually .bi).

--help, -h

Show the usage.

EXIT STATUS

0 on success, 1 when an extract could not be built (the others still are), 2 for bad arguments.

AUTHOR

Nigel Horne <njh@nigelhorne.com>

LICENCE AND COPYRIGHT

Copyright 2026 Nigel Horne.

Usage is subject to the GPL2 licence terms. If you use it, please let me know.