Questions tagged [r-dbi]

DBI is an R package providing a common interface to several databases (currently MySQL, PostgreSQL, SQLite and Oracle are supported, as well as JDBC connections).

DBI is an package providing a common interface to several databases (currently , , and are supported, as well as connections).

Repositories

Other resources

Packages that extend DBI

Users don't often work directly with DBI; you probably want one of these

Related tags

272 questions
0
votes
1 answer

Importing a SSN object into R and getting "unable to find an inherited method"

Similar to: Loading SQLite table in R with RSQLite Receiving an error when I try to import a statistical stream network object. Has anyone worked with the SSN Cran R package and seen this error? SSN: An R Package for Spatial Statistical Modeling on…
0
votes
1 answer

Issues with RS-DBI driver in R

I'm having an issue figuring out why I can't connect to a PSql DB from R. I am able to access the database from the terminal using the psql command, but when connecting through DBI and R I get the following message [with some information…
0
votes
2 answers

Filter table from redshift database using R dplyr

I have a table saved in AWS redshift that has lots of rows and I want to collect only a subset of them using a "user_id" column. I am trying to use R with the dplyr library to accomplish this (see below). conn_dplyr <- src_postgres('dev', …
Kevin
  • 311
  • 5
  • 18
0
votes
0 answers

Add columns to an existing SQL database in R

I'm trying to create an SQL database from a set of data.frames in R. These data.frames have the same row names but different columns. In the SQL database I would therefore like them all to be in the same table, where data.frame1 with n1 columns will…
dan
  • 6,048
  • 10
  • 57
  • 125
0
votes
1 answer

Fetch columns by their names from an SQL database

I have a data.frame stored in an SQL database, created with the dbWriteTable function of the R sqldf package. I was wondering whether there is a way to fetch specific columns by their names from this data.frame in this SQL database. For fetching…
user1701545
  • 5,706
  • 14
  • 49
  • 80
0
votes
1 answer

Connection is lost when fetching data from the database

I have a function that fetches data from a mysql server. I do this using formulas like this: sql <- sprintf("SELECT * FROM `match_player` INNER JOIN `match` ON match_player.match_id=match.id") df_all <- dbGetQuery(con, sql) It all works. However I…
Frits Verstraten
  • 2,049
  • 7
  • 22
  • 41
0
votes
0 answers

Inserting a numeric value into a where statement

I have the following code that works pretty smoothly: sql_cag <- sprintf("SELECT * FROM `CAG_table` WHERE `comp_id` = 1"); df <- dbGetQuery(con, sql_cag) What I would like to do now, however, is to replace the 1 by a parameter. So like this: …
Frits Verstraten
  • 2,049
  • 7
  • 22
  • 41
0
votes
1 answer

Updating values in a database using R does not work

I try to update a row in my sql database using R. Therefore I use the following statement: s <- sprintf("UPDATE `match_data` SET `distance` = '%a' WHERE 'Match.ID' = '%a'", distance, id) check <- dbGetQuery(con, s) Where distance and id are both…
Frank Gerritsen
  • 185
  • 5
  • 14
0
votes
1 answer

How to manage schemas in R & MonetDB?

I've asked a similar question recently, more geared toward dplyr. See dplyr & monetdb - appropriate syntax for querying schema.table? As dplyr & MonetDB (according to @Hannes Mühleisen reply above) don't have a proper way to manage schemas, I…
Enzo
  • 2,543
  • 1
  • 25
  • 38
0
votes
1 answer

hHw to pass a system function to MonetDB through R?

Using MonetDB.R, I want to run this command but I don't want to open up mclient. Is there a generic way to do this? create function div_noerror(l double, r double) returns double
Anthony Damico
  • 5,779
  • 7
  • 46
  • 77
0
votes
0 answers

Reserve MySQL connections

I have a parallel process that makes and closes many MySQL connections. Each process only makes one connection at any given time. Often times while mid-process (and a connection is not established) another external connection is made such that the…
dayne
  • 7,504
  • 6
  • 38
  • 56
0
votes
1 answer

How to append to SQLite table in R with autogenerated fields

This is a similar problem to this question, but I do not want the missing columns filled in with NA, because the missing columns have meaningful default values including the primary key. I am trying to append to a SQLite table from R where the…
dayne
  • 7,504
  • 6
  • 38
  • 56
0
votes
1 answer

Issue with fetch in ROracle

I am having issues on retrieving a large amount of data using ROracle (I have read-only rights on the Oracle database) As the data involved exceeds > 4 gigs I am not able to use the dbGetQuery from ROracle that works perfectly. Instead I am trying…
user3193920
  • 235
  • 2
  • 10
0
votes
1 answer

How to import 14 digits integer column into R from SQLite

I have a SQLite table containing a DATETIME column expressed in milliseconds since epoch. That is a 14 digits integer. I import the table into R with the following require(DBI) con <- dbConnect("SQLite", dbname = database) query <-…
CptNemo
  • 6,455
  • 16
  • 58
  • 107
0
votes
1 answer

dbGetQuery returns character classes instead of Date or POSIXlt

If I read out a field of type "datetime" it returns a character vector. Is it the genral way or do I have to notice something? This post came up with a similar question.
Klaus
  • 1,946
  • 3
  • 19
  • 34
1 2 3
18
19