get_query() for ORM backends