rdplyrrmysql

How to prevent RMySQL warnings "Unsigned INTEGER in col imported as numeric"?


When loading data from a MySQL table there are often warnings such as :

unrecognized MySQL field type 7 in column 26 imported as character

Unsigned INTEGER in col 3 imported as numeric

How can I correctly load the database table into a dataframe so that these warnings are not shown?

I see the function RMySQL::dbDataType() can "Determine the SQL Data Type of an S object". Is there a way to tell it which MySQL data type matches which vector type in a data frame?


Solution

  • You're not doing anything incorrectly--RMySQL "helpfully" gives you all those warnings just in case that wasn't what you want (it almost always is). @hadley recommends installing the development version (0.11.x) in which this annoyance is reportedly solved. Otherwise, you can use suppressWarnings(...), where ... is the statement for which you want to hide warnings. Or just live with it till version 0.11 hits CRAN.