ractogateway.pipelines.sql_analyst._guard
Read-only SQL guard — blocks write operations before execution.
- class ractogateway.pipelines.sql_analyst._guard.ReadOnlySQLGuard[source]
Bases:
objectValidates that a SQL string contains only read (SELECT) operations.
Uses a keyword regex to detect any DML/DDL statement that would modify data or schema. Call
check()before executing any LLM-generated SQL whenforce_read_only=True.Example:
ReadOnlySQLGuard.check("SELECT * FROM users") # passes silently ReadOnlySQLGuard.check("DROP TABLE users") # raises ReadOnlyViolationError