Coverage for src / sql_tool / core / models.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-02-14 14:55 -0500

1"""Query result models for SQL Tool. 

2 

3Pydantic models for representing query results and column metadata 

4returned by PgClient.execute_query(). 

5""" 

6 

7from __future__ import annotations 

8 

9from typing import Any 

10 

11from pydantic import BaseModel, ConfigDict 

12 

13 

14class ColumnMeta(BaseModel): 

15 """Metadata for a single result column.""" 

16 

17 name: str 

18 type_oid: int 

19 type_name: str 

20 

21 

22class QueryResult(BaseModel): 

23 """Result of a SQL query execution.""" 

24 

25 model_config = ConfigDict(arbitrary_types_allowed=True) 

26 

27 columns: list[ColumnMeta] 

28 rows: list[tuple[Any, ...]] 

29 row_count: int 

30 status_message: str