Questions tagged [rmysql]

An R package for interfacing with MySQL and MariaDB databases.

RMySQL is an package providing an interface to and databases. RMySQL uses the interface which is also used by the packages , , , and .

Repositories

Other resources

Related tags

418 questions
2
votes
1 answer

SQL query for GROUP BY, return groups that match the conditions of LEAST, COALESCE

I want to write an SQL query calling for several columns with a bit complicated conditions. I'm working on R Studio using RMySQL package. My server is MySQL. The table looks like this. organisation Tour_ID A B C …
Makoto Miyazaki
  • 1,743
  • 2
  • 23
  • 39
2
votes
1 answer

Could not run statement: Lost connection to MySQL server during query

Transferring an R data frame to a MySQL (MariaDB) database table, I get the following error: Lost connection to MySQL server during query Example data can be loaded in R with this command cntxt <-…
Paul Rougieux
  • 10,289
  • 4
  • 68
  • 110
2
votes
2 answers

RMySQL - dbWriteTable() - The used command is not allowed with this MySQL version

I am trying to read a few excel files into a dataframe and then write to a MySQL database. The following program is able to read the files and create the dataframe but when it tries to write to the db using dbWriteTable command, I get an error…
Neha
  • 153
  • 3
  • 18
2
votes
1 answer

Connect to MySQL from shinyapps.io

I have a working Shiny App that queries a remote MySQL database via pool that I can run on my local machine. The MySQL server has whitelisted shinyapps.io IP addresses. When I deploy it to shinyapps.io, I get this error: …
Rich Pauloo
  • 7,734
  • 4
  • 37
  • 69
2
votes
1 answer

How to avoid timeout error loading large files into mysql in parallel

I have to cycle through several sets of data stored separately in individual csv files - about 1500 files. Each file represents the amount of activity for a given day, and the amount of data in each file varies from basically nothing to huge. My…
Manny Wilson
  • 51
  • 1
  • 6
2
votes
1 answer

Integer column fetched with RMySQL can't be converted to double

Well, the conversion with as.double appears to work, but then adding a non-integral number gets truncated back to integer. For example, this is the setup: geo <- fetch.data.from.mysql(...) > head(geo$total_time) [1] 1586 165 5339 1586 2895 1178 >…
Daniel Dickison
  • 21,832
  • 13
  • 69
  • 89
2
votes
2 answers

How to unserialize php-serialized data in R?

In mysql database, have data serialized by php as below: "a:564:{s:13:\"caltime\";s:6:\"65.26\"; I use Rmysql to query these data, but donot know how to unserialize them in R. Thank for any help!
jackson883
  • 71
  • 9
2
votes
1 answer

How to check if the connection to MySql through RMySql persists or not?

I have connected to a mysql database through the RMySQL package using this statement: con<-dbConnect(drv=RMySQL::MySQL(max.con=1,fetch.default.rec=500),host="host",dbname="dbname",password="psswd",user="user")) So far no issues. When I…
tushaR
  • 3,083
  • 1
  • 20
  • 33
2
votes
2 answers

How to write entire dataframe into mySql table in R

I have a data frame containing columns 'Quarter' having values like "16/17 Q1", "16/17 Q2"... and 'Vendor' having values like "a", "b"... . I am trying to write this data frame into database using query <- paste("INSERT INTO cc_demo…
user6559913
  • 483
  • 4
  • 7
  • 15
2
votes
1 answer

Force UTF-8 Encoding for imported multi-language table using Rmysql from SQL database

I am reading a table from a SQL database, with a column of cities in (English, Arabic and possibly other languages). The encoding type for all is Unknown, when I try to force them using Encoding, some change and some remain Unknown. I tried using…
OmaymaS
  • 1,671
  • 1
  • 14
  • 18
2
votes
2 answers

r dbWriteTable in loop

I have many table that I am saving to a MariaDb in AWS RDS. I can manually save the tables. However I want to create a loop to do and I can't figure out the syntax on the dbWriteTable command. library(RMySQL) dbWriteTable(con, "Account" ,…
Spruce Island
  • 425
  • 1
  • 4
  • 10
2
votes
0 answers

RMySQL connection with --secure_auth=false

I need to get data from an old MySQL server and I'm getting the following error when trying to connect to it with RMySQL or DBI packages: Error in .local(drv, ...) : Failed to connect to database: Error: Connection using old (pre-4.1.1)…
2
votes
1 answer

How to get all mysql databases into r

I want to get a few hundred separate databases into r from mysql. I can get them in separately but I do not know how to make a loop/function/apply to get all of them in at once. Here is how I get them in separately. library(RMySQL) mydb =…
user6452857
  • 117
  • 2
  • 9
2
votes
3 answers

UTF8 encoding using RMySQL

I am trying to query data from a mysql database, which contains some strings, of course. For the connection and data retrieval I am using RMySQL in R, which works fine. Apart from one thing: the strings I am retrieving seem not to be in utf8. But I…
stephan mc
  • 65
  • 1
  • 5
2
votes
1 answer

SSH tunnel to use RMySQL with RStudio

I’m newbie to R with RStudio using Mac(OS X). I successfully use sequel Pro to see DB with like this. I use dbConnect with RMySQL and DBI(below code) with RStudio. library(DBI) library(RMySQL) con <- dbConnect(RMySQL::MySQL(), …
Tsuyoshi Endo
  • 727
  • 1
  • 7
  • 17