Building sql engine