fix(dwh): align adapter sampling contract

This commit is contained in:
2026-07-11 20:14:23 +02:00
parent 717e5ecced
commit 216984aac8
11 changed files with 239 additions and 76 deletions
+2
View File
@@ -4,6 +4,7 @@ from tht.ports.dwh import (
DwhAdapter,
DwhCapabilities,
DwhHealth,
DistinctValues,
UnsupportedCapability,
)
@@ -11,5 +12,6 @@ __all__ = [
"DwhAdapter",
"DwhCapabilities",
"DwhHealth",
"DistinctValues",
"UnsupportedCapability",
]
+8 -2
View File
@@ -21,6 +21,12 @@ class DwhHealth:
detail: str | None = None
@dataclass(frozen=True)
class DistinctValues:
values: list[object]
truncated: bool
class UnsupportedCapability(Exception):
"""Raised when an adapter cannot provide an optional DWH operation."""
@@ -34,10 +40,10 @@ class DwhAdapter(Protocol):
def introspect(self) -> PhysicalSchema: ...
def run_query(self, sql: str, *, limit: int | None = None) -> ExecResult: ...
def run_query(self, sql: str, *, limit: int) -> ExecResult: ...
def explain(self, sql: str) -> PlanSummary: ...
def sample_column(self, table: str, column: str, *, limit: int) -> list[object]: ...
def distinct_values(self, table: str, column: str) -> list[object]: ...
def distinct_values(self, table: str, column: str) -> DistinctValues: ...