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.0a2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sqltoviz-0.1.0a2.tar.gz | 383.6 kB | With provenance | Details for sqltoviz-0.1.0a2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqltoviz-0.1.0a2-py3-none-any.whl | Python 3 | none | any | Details for sqltoviz-0.1.0a2-py3-none-any.whl |
Total release size: 776.8 kB
Release files / sqltoviz-0.1.0a2.tar.gz
| Download URL | sqltoviz-0.1.0a2.tar.gz |
|---|---|
| Size | 383.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b9bc7414fba9a0fee808487523fa7bf97c14d5dc77361a344bcd6b4fd17ac07
|
|
BLAKE2b-256 checksum How to use checksums |
8d29dba302906dc9100739835086b591da783d7ccce71cf8f81c5a1a0393f9ef
|
| 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 logRelease files / sqltoviz-0.1.0a2-py3-none-any.whl
| Download URL | sqltoviz-0.1.0a2-py3-none-any.whl |
|---|---|
| Size | 393.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
841b05a3cae2746ff1e5c831ff76b29c764f047be3d18aae395cad557c89bbec
|
|
BLAKE2b-256 checksum How to use checksums |
77f8718ba6839b3e655ade83673116fb4d3a07e18a0bd8138963d277d394ddb7
|
| 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 logSecurity for sqltoviz 0.1.0a2
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.
Attestation for sqltoviz-0.1.0a2.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 logA 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.