added support for raw sql lookups