fix(core): preserve adapter command contracts
This commit is contained in:
@@ -22,8 +22,10 @@ class ThothRestDwhAdapter:
|
||||
result = self._client.ping()
|
||||
except RestError as exc:
|
||||
return DwhHealth(ok=False, detail=str(exc))
|
||||
ok = bool(result.get("db_connected", True))
|
||||
return DwhHealth(ok=ok, detail=None if ok else str(result))
|
||||
ok = bool(result.get("db_connected") and result.get("schema_accessible"))
|
||||
return DwhHealth(ok=ok, detail=None if ok else str(result),
|
||||
database=self._database.database, schema=self._database.db_schema,
|
||||
endpoint=self._client.cfg.base_url, read_only=True)
|
||||
|
||||
def introspect(self) -> PhysicalSchema:
|
||||
return introspect_rest(
|
||||
@@ -44,10 +46,10 @@ class ThothRestDwhAdapter:
|
||||
except RestError as exc:
|
||||
raise ExecutionError(str(exc)) from exc
|
||||
|
||||
def distinct_values(self, table: str, column: str) -> DistinctValues:
|
||||
def distinct_values(self, table: str, column: str, *, limit: int) -> DistinctValues:
|
||||
try:
|
||||
return sampling.distinct_values_rest(
|
||||
self._client, self._database.db_schema, table, column
|
||||
self._client, self._database.db_schema, table, column, max_values=limit
|
||||
)
|
||||
except RestError as exc:
|
||||
raise ExecutionError(str(exc)) from exc
|
||||
|
||||
Reference in New Issue
Block a user