RS-DBI driver warning: (unrecognized MySQL 7 field type in column 1, imported as a character)

I am trying to run a simple query that works with MySQL or other MySQL connector APIs,

SELECT * FROM `table` WHERE type = 'farmer' 

I tried various methods using RMySQL package and they all get the same RS-DBI driver warning: (unrecognized MySQL field type 7 in column 1 imported as character) error RS-DBI driver warning: (unrecognized MySQL field type 7 in column 1 imported as character)

 Type = 'farmer' (Query<-paste0("SELECT * FROM `table` WHERE type = '%",Type,"%'")) res<-dbGetQuery(con, Query) Query<-paste("SELECT * FROM `table` WHERE type = \'farmer\'") Query<-paste("SELECT * FROM `table` WHERE type = 'farmer'") 

What am I doing wrong?

+4
source share
2 answers

It looks like there is something in the db schema in the column that is of type 7, and this type is unknown to the RMySQL driver.

I am trying to exclude column one in the query or point it at select * ... level, for example, through something like

  select foo as character, bar, bim, bom from 'table' where ... 
+1
source

"type" is a keyword in MYSQL. Surround it with back windows to avoid field names.

 SELECT * FROM `table` WHERE `type` = 'farmer' 

Also, you probably have a timestamp column in your table. It is known that R does not recognize the type of column. Convert it to a unix timestamp in the SQL statement part.

+9
source

All Articles