fix(dwh): validate adapter limits strictly
This commit is contained in:
@@ -2,14 +2,19 @@
|
||||
|
||||
from sqlalchemy import Engine
|
||||
|
||||
from tht.execute import ExecResult, PlanSummary, explain as _explain, run_controlled
|
||||
from tht.execute import (
|
||||
ExecResult,
|
||||
PlanSummary,
|
||||
explain as _explain,
|
||||
require_positive_int,
|
||||
run_controlled,
|
||||
)
|
||||
|
||||
DEFAULT_TIMEOUT_MS = 30_000
|
||||
|
||||
|
||||
def run_query(engine: Engine, sql: str, *, limit: int) -> ExecResult:
|
||||
if limit <= 0:
|
||||
raise ValueError("limit must be a positive integer")
|
||||
limit = require_positive_int(limit, name="limit")
|
||||
return run_controlled(
|
||||
engine,
|
||||
sql,
|
||||
|
||||
Reference in New Issue
Block a user