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?
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.
Switching from RMySQL to RMariaDB also removes the warnings, see https://github.com/r-dbi/RMySQL/issues/37.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With