Files
nvi/api/tools/types.py

29 lines
621 B
Python

"""Public data shapes for the Tools layer.
Tool-output types only. The dataset model (Column, Table, Metric, Recon)
lives in `api/recon/types.py` — Tools consume it but don't own it.
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any
@dataclass
class QueryResult:
columns: list[str]
rows: list[list[Any]]
row_count: int
truncated: bool
def as_dicts(self) -> list[dict[str, Any]]:
return [dict(zip(self.columns, r)) for r in self.rows]
@dataclass
class T2SResult:
sql: str
used_tables: list[str]
explanation: str | None = None