Tabalyst Inspect
Overview, commands and pages.
Tabalyst ToolsAvailable
A JSON file can hold several arrays and a workbook several sheets. Tabalyst Inspect reads the file once, finds which array, sheet or table holds the records and writes its answer in a file beside the source, which you can edit.
tabalyst inspect orders.json
Inspect: orders.json-inspect.json
Selection: $.customers[] (the only eligible collection)
tabalyst inspect sales.xlsx
Inspect: sales.xlsx-inspect.json
Selection: $.Orders (much larger than $.Regions)
Real output of tabalyst 0.6.1, paths shortened.
The tool
Inspect reads a JSON, JSONL or NDJSON file once, lists the arrays it finds and selects the collection of records. When several are equally plausible, it says so instead of guessing.
For a .xlsx or .xlsm workbook, Inspect lists the sheets and named tables, proposes one and notes where its header row is, even under a title.
The result is a file beside the source. Its config section holds the rules that scan and report apply: edit it, then run them as usual. Inspecting again refreshes the detection and keeps your config.
Inspect is optional. tabalyst scan and tabalyst report inspect a JSON file themselves when it has no Inspect file. Use it when you want to see, check or change the choice before the analysis.
Get started
pip install tabalyst# Also updates it: Tabalyst changes often
tabalyst inspect orders.json# Writes orders.json-inspect.json beside the source
tabalyst inspect sales.xlsx# Lists sheets and named tables, writes sales.xlsx-inspect.json
tabalyst report orders.json# Report and scan apply the config of the Inspect file
import tabalyst # Writes the Inspect file beside the source and returns itinspection = tabalyst.inspect("sales.xlsx") # Reports apply the config of the Inspect filebatch = tabalyst.generate_reports(["sales.xlsx"], output_dir="reports")
Real output
The Inspect file of orders.json, shortened. Everything outside config is replaced each time Tabalyst inspects the source.
{
"format": "tabalyst.inspect",
"format_version": "0.1.0a",
"format_revision": 1,
"detection": {
"candidates": [{
"path": "$.customers[]",
"elements": 60,
"eligible": true
}],
"selection": {
"path": "$.customers[]",
"basis": "only_eligible_candidate"
}
},
"config": {
"structure": { "dataset_path": "$.customers[]" },
"flatten": { "enabled": true, "separator": "." },
"arrays": { "mode": "preserve" },
"errors": { "policy": "strict" }
}
}Some fields are left out. For a workbook, config.structure also holds header_row.
Scope, not hype
.xlsx, .xlsm) files. A CSV file is refused with exit code 2: there is nothing to find in a CSV.scan and report stop before analyzing anything and list the candidates. Choose one in the Inspect file or with --collection..xls files are not read, and the Inspect file format is still experimental.The known limitations ↗ list the rest.
Next step
Overview, commands and pages.
Detection, selection rule and messages.
Sheets, named tables and the header row.
The structure of the Inspect file.