问题
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