Added some small db tests and creating dict factory for queries.