added support for automatically extracting id in select queries