1
我的當前代碼基本上遍歷所有在我的Excel文件中的行迭代後插入。我想介紹一種可以每隔50行執行一次插入操作的開關斷路器。如何引入一個開關斷路器來執行插入每50行
db = Database(settings)
elt_insert_line = "INSERT INTO elt_data VALUES"
for row in r:
elt_insert_line = elt_insert_line + "(" + row[2] + ", " + row[3] + "),"
db.execute(elt_insert_line.rstrip(",")).commit().cleanup()