Skip to main content

validate

Function validate 

Source
pub fn validate(
    sql: &str,
    allowed: &HashSet<String>,
    max_datasets: usize,
) -> Result<ValidatedSql, AppError>
Expand description

Validate sql for the raw-SQL endpoint.

Accepts a single read-only SELECT / WITH … SELECT or a DESCRIBE / DESC <table> statement. allowed is the set of registered dataset caller (matching is case-insensitive). max_datasets caps how many distinct datasets a single statement may touch (phase 1 = 1).

On success returns the cleaned SQL ready to be wrapped in an outer LIMIT and executed by the backend (DESCRIBE is run as-is; see is_describe).