reinstating calls to to_database in query and function get_dict
NamedColumn reinstate to_database
removing debug print statements