HeyI´ve this code to read a PYTHON API and store the data in a mysql, I need to optimize and be faster.Can you help me to optimize the python script to be faster.?
cur = con.cursor(buffered=True)t = Tranco(cache=True, cache_dir='.tranco')latest_list = t.list()print(latest_list.top(1000000))for i in range(len(latest_list.top(1000000))): mySql_insert_query = """INSERT INTO Domain (rank, Domain, date) VALUES (%s, %s, %s)""" my = (i,latest_list.top(1000000)[i],datetime.datetime.today()) cur.execute(mySql_insert_query, my) con.commit() print("Data was was inserted.")
i+=1
Success story sharing