Version 0.4 of the dbWriteTable package allowed to copy a data.frame to a database table even if the column names of the two objects did not match. Current version (0.6) instead throws an error in such a situation.
Is there a way to bypass the…
My R workflow now involves dealing with a lot of queries (RPostgreSQL library). I really want to make code easy to maintain and manage in the future.
I started loading large queries from separate .SQL files (this helped) and it worked great.
Then I…
I am struggling to understand what exactly happens behind the scenes when passing POSIXct objects between R and Postgres using RPostgreSQL. In the following example, I define two timestamp fields: one with a timezone the other one without. However,…
This is basic, and I apologize if I missed the existing answer. I am trying to select rows in a db where the userid matches any string in an array I provide. Here are the methods I've tried:
query_string = "SELECT * FROM data WHERE userid =…
I have my password to database stored in pgpass.conf file. I am connecting to database from R with RPostgres, without specifying password so it is read from pgpass.conf, like this:
con <- dbConnect(RPostgres::Postgres(),
dbname =…
The suggest url for my redshift server has a ?tcpKeepAlive=true appended to it, so that it looks something like
jdbc:postgresql://myserver:myport/dbname?tcpKeepAlive=true
Now, the RPostgres::dbConnect function has signature
dbConnect(dbname = NULL,…
I've run into a strange problem that occurs on my CentOS 6.5 box hosted on AWS that does not occur on my Windows machine.
When sending a large dbSendQuery (string with 15,000+ bytes/characters), I get error messages. With smaller queries, it runs…
For testing purposes, I am querying the same table from the same database using two different GUIs (RStudio and SquirreLSQL).
The query in the SquirreLSQL console looks like this:
select count(distinct idstr) from fact_table where…
I'm using RPostgreSQL and sqldf inside my function like this:
MyFunction <- function(Connection) {
options(sqldf.RPostgreSQL.user = Connection[1],
sqldf.RPostgreSQL.password = Connection[2],
…
What is the best way to interrupt a long-running query in RPostgresql?
For example, I wanted to see the first 10 rows of a table and meant to type,
dbGetQuery(con,"
select * from big.table
limit 10
")
But I sometimes leave out the "limit…
I am using RPostgreSQL I have done number of process and I got a table in R. I wanted to put this table in PostgreSQL from R for further analysis that I will use PostgreSQL codes. The problem is that when I have a table in R which doesn't exist in…
I'm running a postgreSQL query based on an automated list of ID's stored in an R list. I'm trying to determine how to include that R list in my query so I don't have to hard-code the ID's each time I run my query.
For example, I have a script that…
I am trying to connect to redshift database using R.
Since I upgraded my mac to Monterey I receive a message in R as
" R Session Aborted -R encountered a fatal error - the session was terminated"
here is the code that produces the error
sourcing it…
I am trying to connect to my localhost Postgres DB within R to further read/write tables. The server is running in the background which I'm monitoring in the background. I'm using the RPostgreSQL library.
pg <- dbDriver(drvName = "PostgreSQL")
…
I'm wondering if there's a way to import PostgreSQL dump through R (RPostgreSQL) into a PostgreSQL database.
I understand this is the way we write csv or a datatable from R into PostgreSQL through RPostgreSQL.
dbWriteTable(con, 'mtcars',…