CORE-5082: modified the metatdata attribute listing query to work with the new database structure