Pandas to_sql Error: Invalid column name 'None'

蓝咒 提交于 2019-12-02 07:37:48

问题


I am using pandas to_sql() to insert pandas's dataframe to sql database, using following snippet:

params = quote("DRIVER={SQL Server};SERVER=%s;DATABASE=%s;UID=%s;PWD=%s"%(config.server,config.database,config.user_id,config.password))
self.engine = create_engine("mssql+pyodbc:///?odbc_connect=%s" % self.params) 

Connection is working fine.

dataframe.to_sql("InvoiceStandardization_InvoiceExtractTemp", con=self.engine, if_exists="append", index=False)

When I tried this it's showing error as :

[42S22] [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'None'. (207) (SQLExecDirectW)")

I have checked all columns are available in my dataframe which are in database in same order. What could be the possible solution?

来源:https://stackoverflow.com/questions/50503934/pandas-to-sql-error-invalid-column-name-none

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!