Skip to content

Getting started — Dash

  1. Install the package (Python 3.12+):

    Terminal window
    pip install dash-tensor-grid
    # optional pandas ingestion path:
    pip install "dash-tensor-grid[pandas]"
  2. Build a payload from any data source with the declarative config, and drop the component into your layout:

    from dash import Dash
    from dash_tensor_grid import TensorGrid, build_grid
    sales = [
    {"region": "EMEA", "country": "Germany", "revenue": 100, "cost": 60},
    {"region": "AMER", "country": "USA", "revenue": 200, "cost": 120},
    # …a list[dict], pandas/Polars DataFrame, or JSON string
    ]
    payload = build_grid(sales, {
    "rows": ["region", "country"],
    "measures": {"revenue": "sum", "cost": "sum"},
    "formats": {"revenue": "currency:USD", "cost": "currency:USD"},
    "grand_total": True,
    })
    app = Dash(__name__)
    app.layout = TensorGrid(
    id="grid",
    row_data=payload["row_data"],
    column_defs=payload["column_defs"],
    )
    if __name__ == "__main__":
    app.run(debug=True)
  3. Run itpython app.py — and you have a live, expandable OLAP grid.

That’s the whole thing. The result looks like this (rendered here with the vanilla adapter — same engine, same numbers):