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
5
votes
4 answers

How to query number of Ids in batches in R

I have below mentioned dataframe in R. ID Amount Date IK-1 100 2020-01-01 IK-2 110 2020-01-02 IK-3 120 2020-01-03 IK-4 109 2020-01-03 IK-5 104 2020-01-03 I'm using ID to fetch some…
Vector JX
  • 179
  • 4
  • 23
5
votes
1 answer

dbWriteTable function returning TRUE status even if it fails to insert record as it violates the schema constraints

I am using DBI, RMySql packages for interacting with MySql database. Here are more details about configuration: R version: 3.3.2 DBI version: 0.7 RMySql version: 0.10.13 Below is the schema for table…
Abhinandan Satpute
  • 2,558
  • 6
  • 25
  • 43
5
votes
2 answers

Add a dynamic value into RMySQL getQuery

Is it possible to pass a value into the query in dbGetQuery from the RMySQL package. For example, if I have a set of values in a character vector: df <- c('a','b','c') And I want to loop through the values to pull out a specific value from a…
analyticsPierce
  • 2,979
  • 9
  • 57
  • 81
5
votes
1 answer

RMySQL: internal error in RS_DBI_getConnection: corrupt connection handle

So I connected to my database just fine in the beginning: con <- dbConnect( MySQL(), user = "username", password = "password", host = "", port = 3306 ) So everything was working but after a couple…
cullan
  • 280
  • 3
  • 13
5
votes
2 answers

dbSendQuery only returning 500 rows when using RMySQL in R

I am using RMySQL to query a database. I used df <- fetch(dbSendQuery(con, "SELECT some_col from some_table")) and got back this message: Error in fetch(dbSendQuery(con, "SELECT some_col from some_table")) : error in evaluating the argument…
tumultous_rooster
  • 12,150
  • 32
  • 92
  • 149
5
votes
1 answer

MySQl and R : Error connecting Database

I am a novice in R. I am trying to connect to mySQL in R through RMyQL package. I am using the following command to connect to a sql server…
Krish Mahajan
  • 263
  • 3
  • 9
5
votes
1 answer

Rmysql dropping tables R language

I am using R on Linux/Ubuntu machine. I am using RMySQL package to connect to a MySQL database I need to drop a table from that database and would like to know a suitable command. I already looked the package documentation and searched for "drop"…
user2543622
  • 5,760
  • 25
  • 91
  • 159
5
votes
3 answers

R bulk upload data to MYSQL database

there is the package: RMySQL How can I bulk upload lots of data to mysql from R? I have a csv with around 1 million lines and 80 columns. Would something like this work? dbWriteTable(con, "test2", "~/data/test2.csv") ## table from a file I fear…
user670186
  • 2,588
  • 6
  • 37
  • 55
5
votes
0 answers

RMySQL resultset is not "complete" after all results have been fetched

In a script that processes a lot of rows in a MySQL server, I use dbSendQuery and fetch to throttle the fetching and processing of results. When my fetch command retrieves exactly the number of rows available (or left) in the resultset, leaving 0…
Ben Companjen
  • 1,417
  • 10
  • 24
5
votes
3 answers

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

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:…
pyCthon
  • 11,746
  • 20
  • 73
  • 135
5
votes
1 answer

Is it possible to add index to database table through R(RMySQL)

I have created a table output and connected to database through RMySQL, and now I need to add index to the table, I searched around but didn't found what I need in R language, please help. A small example of the table would look like this: mth <-…
Rosa
  • 1,793
  • 5
  • 18
  • 23
4
votes
3 answers

RMySQL, fetch errors - RS-DBI driver warning: (error while fetching rows)

I am using RMySQL to fetch some rows from a data table (the table is large so I cannot post it here but basically contains a bunch of numbers.. a total of 10 columns and about 12,000 rows). I get the following error when I run fetch(con,…
Alex
  • 19,533
  • 37
  • 126
  • 195
4
votes
2 answers

R: Update a mysql table with data frame

I have a MariaDB and I want to update a table with a local R data frame. As an example, I have a table with these column names: id,foo,bar id is the primary key on the data base table. Is there a function with which I can easily update the remote…
MKR
  • 1,620
  • 7
  • 20
4
votes
3 answers

Connecting to MySQL from R

I am trying to connect to MySQL from R. I have installed "8.0.11 MySQL Community Server - GPL" on my machine. In R studio, I have installed RMySQL Library. When I give the command: con = dbConnect(RMySQL::MySQL(),user="root", password = "password",…
user9549524
  • 57
  • 1
  • 1
  • 6
4
votes
1 answer

How do I remove embedded quotes from sqlInterpolate function of R?

I am trying to generate a bunch of SQL scripts using DBI::sqlInterpolate function but constantly get SQL error as the script embeds quotes that are returned with the R variable. Here is the code: > x<-'state_transtions' > y<-'transition_time' >…
Lazarus Thurston
  • 1,197
  • 15
  • 33
1 2
3
27 28