fix(dwh): align adapter sampling contract
This commit is contained in:
@@ -4,6 +4,7 @@ from tht.ports.dwh import (
|
||||
DwhAdapter,
|
||||
DwhCapabilities,
|
||||
DwhHealth,
|
||||
DistinctValues,
|
||||
UnsupportedCapability,
|
||||
)
|
||||
|
||||
@@ -11,5 +12,6 @@ __all__ = [
|
||||
"DwhAdapter",
|
||||
"DwhCapabilities",
|
||||
"DwhHealth",
|
||||
"DistinctValues",
|
||||
"UnsupportedCapability",
|
||||
]
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user