Create db query object