Query can now return dict_dict (dict of dict) or pandas df and can writeout df