pandas.to_sql with new columns to existing table, add automatically new columns?

前端 未结 2 1491
天涯浪人
天涯浪人 2021-02-08 05:01

I want to write a dataframe to an existing sqlite (or mysql) table and sometimes the dataframe will contain a new column that is not yet present in the database. What do I need

2条回答
  •  终归单人心
    2021-02-08 05:21

    if there are extra columns in your dataframe then you need to manually add that column to the database table for the df.to_sql() to work.

提交回复
热议问题