Choose a Validation Level
Choose the lowest setup cost that still gives the confidence you need today.
| Level | Activation | Best For | Checks Included | Does Not Check |
|---|---|---|---|---|
| 1 | Default | Fast adoption and broken-SQL detection | Structural syntax | Dialect-specific functions, schema objects |
| 2 | Set QueryLens.Dialect |
Teams targeting one known engine | Level 1 plus dialect rules, reserved words, version-gated functions | Real tables, columns, procedures |
| 3 | Load schema snapshot | High-confidence test suites | Level 2 plus object existence and schema-backed write checks | Runtime data, permissions, execution plans |
Recommendations
- Small teams can start at Level 1 and move to Level 2 once the target engine is stable.
- Larger teams usually benefit from Level 2 quickly because dialect drift is common.
- Level 3 is worth the extra setup when schema drift or object-name regressions are a recurring source of bugs.
Example
var level1 = new SqlQuery("SELECT name FROM customers LIMIT 10");
Assert.True(level1.IsValid);
QueryLens.Reset();
QueryLens.Dialect = DialectProfile.SqlServer2019;
var level2 = new SqlQuery("SELECT STRING_AGG(name, ',') FROM dbo.departments");
Assert.True(level2.IsValid);