fix(dwh): validate adapter limits strictly
This commit is contained in:
@@ -26,6 +26,13 @@ class PlanSummary:
|
||||
node_types: list[str]
|
||||
|
||||
|
||||
def require_positive_int(value: object, *, name: str) -> int:
|
||||
"""Return a validated positive integer, excluding booleans and numeric lookalikes."""
|
||||
if type(value) is not int or value <= 0:
|
||||
raise ValueError(f"{name} must be a positive integer")
|
||||
return value
|
||||
|
||||
|
||||
def _inject_limit(sql: str, limit: int) -> tuple[str, bool]:
|
||||
"""Aggiunge LIMIT limit+1 se assente (il +1 serve a rilevare il troncamento).
|
||||
Se la query ha gia' un suo LIMIT, lo si rispetta."""
|
||||
|
||||
Reference in New Issue
Block a user