rpostgresql

RPostgreSQL - R Connection to Amazon Redshift - How to WRITE/Post Bigger Data Sets

你离开我真会死。 提交于 2019-12-13 13:20:45
问题 I'm experimenting with how to connect R with Amazon's Redshift - and publishing a short blog for other newbies. Some good progress - I'm able to do most things (create tables, select data, and even sqlSave or dbSendQuery 'line by line' HOWEVER, I have not found a way to do a BULK UPLOAD of a table in one shot (e.g. copy the whole 5X150 IRIS table/data frame to Redshift) - that doesnt take more than a minute. Question: Any advice for a newish person to RPostgreSQL on how to write/upload a

Exporting Table from R to PostgreSQL by RPostgreSQL

不问归期 提交于 2019-12-12 09:53:01
问题 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 PostgreSQL, I cannot perform SQL Codes on it. Sample Table s_2 the data format is not data frame and temp is float and DateeTIMEE is timestamps: temp DateeTIMEE 1 -1.64 2007-09-29 00:01:09 2 -1.76 2007-09-29 00:03:09 3 -1.83 2007-09-29 00:05:09 4 -1

How to execute sql query files via RPostgreSQL

对着背影说爱祢 提交于 2019-12-12 07:38:40
问题 I am accessing my PostgreSQL database (9.3) via R using the RPostgreSQL package. I have a few very long and big sql queries (several MB big. generated from raster2pgsql). How can I send / execute sql query files as statement within R? The normal way \i query.sql does not seem to work via dbSendQuery . I tried to read in the whole sql file as character vector via readLines , however this also fails, because dbSendQuery only supports a single command apparently? 回答1: dbSendQuery or dbGetQuery

How to update rows in Database with values from data.frame in R conditionally

懵懂的女人 提交于 2019-12-12 06:38:34
问题 I've a data.frame in R - matches with some 1000+ rows names(matches) [1] "name" "c_id" "fname" "lname" "address" "zip_code" "Weight" nrow(matches) [1] 1253 I have a postgresql database table - list_m with following columns db_name, db_cid, db_weight, processing_status, request_id, fname, mname, lname, etc. I want to udpate the values of only few columns (db_c_id, db_weight and processing status) in the table using values from the data.frame. As of now, I am looping over the data.frame to

RPostgreSQL installation Error - RPostgreSQL.so: undefined symbol: PQpass

孤者浪人 提交于 2019-12-10 15:57:36
问题 I am trying to install R-Package RPostgreSQL, but getting the following error, Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/usr/lib64/R/library/RPostgreSQL/libs/RPostgreSQL.so': /usr/lib64/R/library/RPostgreSQL/libs/RPostgreSQL.so: undefined symbol: PQpass Error: loading failed Execution halted ERROR: loading failed * removing ‘/usr/lib64/R/library/RPostgreSQL’ I have libpq and postgresql-dev installed. All the library files are in the directory /usr/lib64

Cannot connect to Amazon PostgreSQL RDS database on R using RPostgreSQL

时间秒杀一切 提交于 2019-12-08 13:31:40
问题 I am having trouble connecting to my Amazon RDS PostgreSQL database using R on RStudio and using the package RPostgreSQL. I am running: library("RPostgreSQL") drv <- dbDriver("PostgreSQL") con <- dbConnect(drv, dbname="mydbname", host="........us-west-2.rds.amazonaws.com", port=5432, user="myuser", password="mypassword") After running this line, I get the error: Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: (could not connect myuser@.........us-west-2.rds.amazonaws.com on dbname

Setting up data refreshing in Shiny app connected to PostgreSQL

这一生的挚爱 提交于 2019-12-07 19:46:31
问题 I've looked at this and this thread and a few others but haven't been able to figure out my solution. I have built a dashboard using R and Shiny, and said dashboard pulls in data from a Postgres db using the RPostgreSQL package. Right now, the code for all the data pulling and analysis is done outside of the shinyServer function, and only the displaying part (the output and render functions) is in the shinyServer portion. I'd like to set it up so that the dashboard data is periodically

How do I interrupt a RPostgresql query in R

旧街凉风 提交于 2019-12-07 15:36:16
问题 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 10" and then my program runs forever. Hitting ctrl-C or the stop button from my R terminal doesn't work. I either have to wait a long time and then see the full output print or I can abort the R process. 回答1: You can try to connect to Postgres with psql look

Setting up data refreshing in Shiny app connected to PostgreSQL

岁酱吖の 提交于 2019-12-06 04:27:56
I've looked at this and this thread and a few others but haven't been able to figure out my solution. I have built a dashboard using R and Shiny, and said dashboard pulls in data from a Postgres db using the RPostgreSQL package. Right now, the code for all the data pulling and analysis is done outside of the shinyServer function, and only the displaying part (the output and render functions) is in the shinyServer portion. I'd like to set it up so that the dashboard data is periodically refreshed and the charts are updated. I've looked into reactivePoll and invalidateLater and understand them,

How do I interrupt a RPostgresql query in R

佐手、 提交于 2019-12-06 02:42:30
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 10" and then my program runs forever. Hitting ctrl-C or the stop button from my R terminal doesn't work. I either have to wait a long time and then see the full output print or I can abort the R process. You can try to connect to Postgres with psql look for your query in select * from pg_stat_activity and then use select pg_cancel_backend(long_query_pid) to