Add support for custom sql queries