Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

r

rmysql

I'm trying to run a simple query that works with MySQL or other MySQL connector API's,

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

I've tried various methods using the RMySQL package and they all get the same 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?

like image 415
pyCthon Avatar asked Dec 22 '12 23:12

pyCthon


1 Answers

"type" is a keyword in MYSQL. Surround the it with backticks to escape field names.

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

Also you probably have a time stamp column in your table. R is known to not recognize that column type. Convert it to a unix time stamp in the portion of the SQL statement.

like image 160
zer0bit Avatar answered Oct 21 '22 19:10

zer0bit