Inside SQLx: How Rust Checks SQL Before Your Application Runs
The session follows a query through the boundary between Rust and the database: from the SQL text and bound parameters, through schema inspection and type analysis, to the Rust value returned to the application.
Description
section.descriptionA practical two-hour session investigating how SQLx can detect invalid SQL, incompatible parameters, missing columns, and incorrect Rust mappings during compilation rather than after deployment.
The session follows a query through the boundary between Rust and the database: from the SQL text and bound parameters, through schema inspection and type analysis, to the Rust value returned to the application. We will deliberately break queries, change schemas, and introduce type mismatches to understand what SQLx can prove before runtimeโand what it cannot.
The emphasis is not on memorizing an API. It is on understanding the engineering model behind compile-time checked SQL, the role of migrations in preserving that model, and the practical consequences for local development, testing, continuous integration, and deployment.
Audience: developers who want to understand how Rust can provide stronger guarantees around ordinary SQL without replacing SQL with an ORM or query language.
Outcomes:
- Trace how SQLx validates a query during compilation
- Understand how database metadata informs Rust type checking
- See compile-time failures caused by invalid queries and incompatible result types
- Understand why the current schema matters during a build
- Connect database migrations to query correctness
- Distinguish checked macros from runtime query APIs
- Evaluate when compile-time SQL checking improves a project and when it adds friction
Format: two hours with a guided investigation, broken-query experiments, migration examples, discussion of operational tradeoffs, and a reusable checklist for database code.
member support
Community members who want this event to happen.
Voting is closed for this proposal.