Initial SQL compilation and query building infrastructure.