Skip to content
Beta · version 0.8.3 · commands and the JSON format may still change.

Python API: Insights

tabalyst.generate_insights() writes the pages of Tabalyst Insights for any number of CSV, JSON, JSONL or Excel files. The command is tabalyst insights.

import tabalyst
batch = tabalyst.generate_insights(["customers.csv"])
batch = tabalyst.generate_insights(["data/*.csv"], output_dir="insights")

Plans and writes, for each source, the main page <name>.insights.html, its profile <name>.insights.json and a page for each column in <name>.insights/, with an executions.json history in the same folder.

tabalyst.generate_insights(
input_specs,
*,
output=None,
output_dir=None,
separator=None,
encoding=None,
collections=None,
config_path=None,
force=False,
on_progress=None,
from_scan=False,
workers=None,
all_collections=False,
confirmed=False,
confirm=None,
dedup_report=None,
)

The parameters mean what they mean for generate_reports(). Returns the same batch result: each success holds the profile as a dictionary in result, the profile that generate_reports(deep=True) writes.

The second pass always runs. When it is costly, nothing is started before it is confirmed, once for the whole batch: confirmed=True says it is, confirm is called with the estimate otherwise and returns whether to go on, and without either the function raises ConfirmationRequired after the sources are scanned. The function never prompts.

A configuration that sets deep.mode to off raises ConfigurationError.

import tabalyst
batch = tabalyst.generate_insights(["big.csv"], confirmed=True)
for success in batch.successes:
print(success.job.output)