Unknown column in field list error Rmysql

2019-07-31 23:37发布

I wrote a data.frame using

dbWriteTable(con, name='db_all', df, overwrite=T, row.names=F) 

sucessfully to MySQL using RMySQL. Now I have a second data frame which has a similar structure and try to use

dbWriteTable(con,name='db_all',df1,append=T,row.names=F,overwrite=F)

which gives me

Error in .local(conn, statement, ...) : could not run statement: Unknown column 'zzz' in 'field list'>

In my SQL table I don't have that column name yet and would expect my append=T will add this column in my SQL table, which apparently it does not.

标签: mysql r rmysql
1条回答
三岁会撩人
2楼-- · 2019-08-01 00:30

The append will append data to the table, will not do an alter table adding columns.

You need to specify your columns if the name is not the same as in the dataframe using a named list e.g: field.types=list(dte="date", val="double(20,10)")

查看更多
登录 后发表回答