def upload_csv(filename: str, table_name: str, extra: Optional[Dict[str, str]] = None): csv_upload_db_id = get_upload_db().id form_data = { "csv_file": open(filename, "rb"), "sep": ",", "name": table_name, "con": csv_upload_db_id, "if_exists": "fail", "index_label": "test_label", "mangle_dupe_cols": False, } if extra: form_data.update(extra) return get_resp(test_client, "/csvtodatabaseview/form", data=form_data)
def upload_excel(filename: str, table_name: str, extra: Optional[Dict[str, str]] = None): form_data = { "excel_file": open(filename, "rb"), "name": table_name, "con": get_upload_db().id, "sheet_name": "Sheet1", "if_exists": "fail", "index_label": "test_label", "mangle_dupe_cols": False, } if extra: form_data.update(extra) return get_resp(test_client, "/exceltodatabaseview/form", data=form_data)