def fetch_index_list(conn): logging.debug("Fetch indices") df = ts.get_index()[['code', 'name']] df.to_sql('stock_index', conn, if_exists="replace", dtype={"code": VARCHAR(32)})