更新时间:2023-01-22 18:16:02
可以创建临时表:
nifty_data.to_sql(name='temporary_table', con=engine, if_exists = 'append', index=False)
然后运行一个 INSERT IGNORE 语句:
And then run an INSERT IGNORE statement from that:
with engine.begin() as cnx:
insert_sql = 'INSERT IGNORE INTO eod_data (SELECT * FROM temporary_table)'
cnx.execute(insert_sql)
只需确保列顺序相同,否则您可能需要手动声明它们.
just make sure the column orders are the same or you might have to manually declare them.