Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

SqlToViz Python alpha

The package exposes two recommendation APIs. Both take SQL text and existing result rows, and run locally.

API Input Result
recommend(sql, rows) SQL text and a list of row dictionaries preview-v0.1 plan with chart type, encodings, warnings and numeric insights
Engine.recommend(sql, schema, rows) SQL text, column schema and positional rows Versioned feature-contract result with class, roles and model status

The deterministic preview supports KPI, bar, horizontal bar, line and table. It accepts 1–5,000 rows with identical sets of 1–50 named scalar columns. Invalid rows or empty SQL raise ValueError. The experimental engine and its optional ONNX dependency are described below.

from sqltoviz import recommend, to_echarts
rows = [{"category":"A","sales":10},{"category":"B","sales":20}]
plan = recommend("SELECT category, SUM(sales) FROM sales GROUP BY category", rows)
print(plan)
print(to_echarts(plan, rows))

Run python -m unittest discover -s tests from this directory. Build with python -m build. Install the generated wheel in a clean environment before release. Adapters support bar, horizontal bar and line only; native KPI/table rendering is the caller's responsibility.

Model-backed engine (experimental)

from sqltoviz import Engine           # pip install "sqltoviz[onnx]"
engine = Engine.default()             # bundled EXPERIMENTAL candidate models (checksum-verified)
rec = engine.recommend("SELECT dept, SUM(sal) AS total FROM emp GROUP BY dept",
                       [{"name": "dept"}, {"name": "total"}], [["a", 10.0], ["b", 20.0], ["c", 5.0]])
rec["final_class"], rec["model_status"], rec["roles"], rec["warnings"]

Engine computes the 32 table and 28 column features of SqlVizSpec-v1.0.0 (pure Python; the contract hash is pinned and checked by CI), scores the 10 base classes with the chart ONNX model, applies hard semantic constraints (fail-closed to table) and infers column roles with the role model. The bundled models are candidates: the chart model is trained on synthetic labels and the role model on 322 Vega-Lite columns; neither has human validation, and every result says model_status: "experimental". To use final models without changing any code, pass them in: Engine(chart_model=path, role_model=path, manifest={"chart": {"sha256": ..., "status": "validated"}, "role": {...}}) or replace sqltoviz/models/manifest.json; the API and result shape are unchanged. Engine() without models is rules-only. SQL is never executed.

Resumen en español

recommend(sql, rows) recibe el SQL y una lista de diccionarios con las filas. Devuelve un plan determinista preview-v0.1 con el gráfico, sus campos, avisos e insights numéricos. Engine.recommend(sql, schema, rows) recibe por separado el esquema y las filas posicionales. Devuelve la clase del gráfico, los roles de columna y el estado del modelo. Los modelos incluidos son experimentales. Ambas interfaces procesan las filas localmente y no ejecutan el SQL.

Chart adapters / Adaptadores de gráficos

to_echarts(plan, rows) returns ECharts options, to_vegalite(plan, rows) returns a Vega-Lite specification, and to_plotly(plan, rows) returns a Plotly figure dictionary. Pass the same rows used for the deterministic recommend call. The three adapters support bar, horizontal bar and line. KPI and table plans raise ValueError so callers can render those directly.

Los tres adaptadores generan configuraciones para sus bibliotecas de gráficos. Usa las mismas filas que entregaste a recommend. Admiten barras verticales, barras horizontales y líneas. Para KPI y tabla, renderiza el plan directamente.

Statistical diagnostics / Diagnósticos estadísticos

The preview returns MAD insights for fully numeric columns. Select additional checks explicitly with temporal_column, pareto_column and correlation_columns=("x", "y"). These populate the optional diagnostics field. Order temporal rows in your SQL. Set pareto_additive=True only when the selected measure adds across disjoint categories.

La vista previa devuelve resultados de MAD para las columnas numéricas. Selecciona columnas explícitamente para tendencias, Pareto y correlación. Los resultados aparecen en diagnostics. Ordena las filas temporales en SQL y activa pareto_additive solo para medidas aditivas en categorías disjuntas.

Metadata

Release files for sqltoviz 0.1.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqltoviz 0.1.0a1
File Size Uploaded Provenance Actions
sqltoviz-0.1.0a1.tar.gz 383.6 kB With provenance Details for sqltoviz-0.1.0a1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sqltoviz 0.1.0a1
File Interpreter ABI Platform Actions
sqltoviz-0.1.0a1-py3-none-any.whl Python 3 none any Details for sqltoviz-0.1.0a1-py3-none-any.whl

Total release size: 776.8 kB

Release files / sqltoviz-0.1.0a1.tar.gz

Download URL sqltoviz-0.1.0a1.tar.gz
Size 383.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1379c52723076c1b457922a38e84974124aecf1f7e579a837ce5de7d3a6a4a24
BLAKE2b-256 checksum
How to use checksums
f04b77f1f79e7fb08d74c1bad95cfcf7856ec9df031e8d9af0cda46356d4543a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / sqltoviz-0.1.0a1-py3-none-any.whl

Download URL sqltoviz-0.1.0a1-py3-none-any.whl
Size 393.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
41aeb629dcff9e03668c2051b974b03a45495ea557fd9e3521c8daa35a48e367
BLAKE2b-256 checksum
How to use checksums
4bb69a158022843d0e900ad8f9077dd927abd458a0187025a3807f7f4dabb1b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for sqltoviz 0.1.0a1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sqltoviz-0.1.0a1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page