refactor(dwh): adapt direct and REST transports
This commit is contained in:
@@ -46,3 +46,14 @@ def explain_rest(client, sql: str) -> PlanSummary:
|
||||
except RestError as e:
|
||||
raise ExecutionError(str(e)) from e
|
||||
return parse_text_plan(lines)
|
||||
|
||||
|
||||
def sample_column_rest(
|
||||
client, schema: str, table: str, column: str, *, limit: int
|
||||
) -> list[object]:
|
||||
rows = client.top_values(schema, table, column, limit)
|
||||
return [row["value"] for row in rows if row.get("value") is not None]
|
||||
|
||||
|
||||
def distinct_values_rest(client, schema: str, table: str, column: str) -> list[object]:
|
||||
return sample_column_rest(client, schema, table, column, limit=1000)
|
||||
|
||||
Reference in New Issue
Block a user