Skip to content

SDK quickstart ​

Install the alpha packages from the public registries (versions are pre-releases, so the flags below are required). These examples use precomputed SQL result rows. Each SDK has a deterministic preview, and the experimental ONNX paths are documented separately.

SDKRuntimeInstall
PythonPython 3.10+pip install --pre sqltoviz (add "sqltoviz[onnx]" for the experimental models)
TypeScriptNode.js 20+npm install sqltoviz@alpha
.NET.NET 8 or 10dotnet add package SqlToViz --prerelease (and SqlToViz.Onnx for the experimental models)

To build from a checkout instead, use python -m build packages/python, cd packages/npm && npm install --ignore-scripts && npm pack, or dotnet pack packages/nuget/SqlToViz/SqlToViz.csproj -c Release -o artifacts.

One result, three SDKs ​

python
from sqltoviz import recommend

plan = recommend("SELECT 42 AS total", [{"total": 42}])
assert plan["chartType"] == "kpi"
js
import { recommend } from 'sqltoviz';

const plan = recommend('SELECT 42 AS total', [{ total: 42 }]);
console.assert(plan.chartType === 'kpi');
csharp
var plan = SqlToViz.Preview.Recommend(
    "SELECT 42 AS total",
    new[] { new Dictionary<string, object?> { ["total"] = 42 } });
Console.WriteLine(plan.ChartType); // kpi

Concrete outputs (additive, TypeScript and .NET) ​

specializeOutputs(columns, rows, metadata, baseScores, roles, baseEligibility) (sqltoviz, sqltoviz/web, sqltoviz/node) refines a base class into one of the 21 outputs of SqlVizSpec-Outputs-v1.0.0 (spec/OUTPUTS_V1.md) using deterministic preconditions, and returns {output, encodings, params, rejected, fallback_chain}. It mirrors the Python specialize_outputs; the .NET port is SqlToViz.Outputs.SpecializeOutputs (below).. The thresholds (category caps, minimum sample sizes, bin rule, whisker factor) are design choices, not validated values. The 120 fixtures in parity/outputs_v1.json prove that the runtimes agree with each other, not that the rules pick the right chart.

csharp
var cols = new[] { new ColumnSpec("region"), new ColumnSpec("revenue") };
var rows = new List<IReadOnlyList<object?>> { new object?[] { "N", 10.0 }, new object?[] { "S", 7.0 } };
var r = SqlToViz.Outputs.SpecializeOutputs(cols, rows, baseEligibility: new Dictionary<string, bool> { ["bar"] = true, ["table"] = true });
Console.WriteLine(r.Output); // bar (rejected candidates and reason codes are in r.Rejected)

Research and model status ​

The research protocol describes the held-out evaluation. The model cards document the training sources, feature contract and limitations. The bundled ONNX models remain experimental. See the roadmap for release and research acceptance criteria.