Setup Query method handler

Setup method to handle queries to the database