Questions tagged [rpostgres]
23 questions
                    
                    2
                    
            votes
                
                1 answer
            
        Properly quoting SQL query with " and ' in R
I need to submit the following  query through my R code:
select t."date"
from db.table t
where t."date" > '2016-01-01';
To generate this quoted string properly, I tried:
sqlquery <- dbQuoteString(ANSI()
              , paste0("select t.", '"',…
         
    
    
        Fabio Correa
        
- 1,257
- 1
- 11
- 17
                    2
                    
            votes
                
                0 answers
            
        Check different connection credentials for r in different environments during testing?
I don't know if this is a bad configuration set up by I am testing connections to different database network settings.
Whilst I am testing the set up I want the app to be able to run with three different set ups:
The development one I have on a…
         
    
    
        aclong
        
- 181
- 2
- 7
                    2
                    
            votes
                
                0 answers
            
        dbConnect to Postgres gives strange error not allowing me to connect
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")
   …
         
    
    
        Coon
        
- 87
- 7
                    2
                    
            votes
                
                1 answer
            
        Unable to find an inherited method for function 'dbClearResult' for signature '"data.frame"'
I have a problem with my R program querying a PostgreSQL database. Here is the code
### Here we assume that myuser, mypassword, db, host_db and db_port
### have been defined in previous lines in the code
db_con  <- dbConnect(
   …
         
    
    
        user17911
        
- 1,073
- 1
- 8
- 18
                    2
                    
            votes
                
                2 answers
            
        R connect to postgres return false in dbExistsTable, but it is wrong
I try connect to my table in postgres.
Here screen of my db.
So i need dbo.social and table profiles.
So to do this, i try
library(RPostgres)
library(DBI)
pw<- {
  "1234"
}
con <- dbConnect(RPostgres::Postgres()
                 ,…
         
    
    
        psysky
        
- 3,037
- 5
- 28
- 64
                    1
                    
            vote
                
                1 answer
            
        How to copy/join few columns from a csv file to an existing SQL table in R?
I have a created a table "SQL_table" in SQL and copied contents from various existing .csv files to "SQL_table" in R using the code given below.
Code:
library(RPostgres)
library(DBI)
#Step 2: make a dataframe of all files
file_names1 <-…
         
    
    
        Alexia k Boston
        
- 97
- 6
                    1
                    
            vote
                
                1 answer
            
        Batch executing query in RPostgres returning same data
I am currently trying to download a large database using RPostgres - however, when I try to write the results to csvs in batches, it writes the same data over and over (always the first 1M records). Here is the code I am currently using:
wrds <-…
         
    
    
        mhohaus
        
- 11
- 1
                    1
                    
            vote
                
                2 answers
            
        Join a data frame (or other R object) to a table in a read-only Postgresql database?
I have read-only access to a Postgres database. I can not write to the database.
Q. Is there a way to construct and run a SQL query where I join a data frame (or other R object) to a table in a read-only Postgres database?
This is for accessing data…
         
    
    
        Kelly Thompson
        
- 11
- 3
                    1
                    
            vote
                
                1 answer
            
        R DBI connection closed unexpectedly by server + server terminated abnormally before or while processing request
I am using DBI and pqdriver for Postgres via RPostgres::Postgres() to establish a connection like the following.
con <- DBI::dbConnect(RPostgres::Postgres(), dbname = "my_db", host = "10.10.10.194", port = 5432, user = "my_user", password =…
         
    
    
        info_seekeR
        
- 1,296
- 1
- 15
- 33
                    1
                    
            vote
                
                1 answer
            
        Problem building R api with plumber, RPostgreSQL, and docker
I'm trying to install plumber and RPostgreSQL into my docker image.  Here's my dockerFile:
FROM rocker/r-base
RUN R -e "install.packages('plumber')"
RUN R -e "install.packages('RPostgreSQL')"
RUN mkdir -p /code
COPY ./plumber.R…
         
    
    
        Benjamin Talisman
        
- 328
- 3
- 8
                    1
                    
            vote
                
                0 answers
            
        RPostgres on Mac fails to connect to Amazon RDS Aurora database
I am facing an awkward issue connecting to a Postgres database deployed on AWS Aurora. Connection attempts from R on Mac OS, using the DBI and RPostgres frameworks are rejected with the message:
 Error: server closed the connection unexpectedly
    …
         
    
    
        Pierre Erwan Saouter
        
- 11
- 2
                    0
                    
            votes
                
                0 answers
            
        Unable to change datatype of columns while import CSV to SQL in R
I have a csv file. I need to import it in SQL. But while importing I need to change the names of columns and I want to change the datatype for all the columns. Csv columns are little weird. Few examples are:
City, special label
City label
Year/Month…
         
    
    
        Alexia k Boston
        
- 97
- 6
                    0
                    
            votes
                
                1 answer
            
        How to use dbSendQuery to import different CSV files into 1 SQL database table using R?
Referring to this page,I am using following code trying to insert multiple csv files into SQL database table using R
#Step 1: Libraries
library(RPostgres)
library(data.table)
library(DBI)
#Step 2: make a dataframe of all files
file_names1 <-…
         
    
    
        Michael_Brun
        
- 51
- 6
                    0
                    
            votes
                
                2 answers
            
        How to import/copy different csv files into 1 table in SQL using R?
I have multiple csv files (1 file for each city) having following structure.
An example of two out of many files:
CSV File 1:
City_Name  Pop  PopDen  Lit
MI  45000  280  78
MI  37000  310  89
...
...
CSV File 2:
City_Name  Pop  PopDen  Lit
CH …
         
    
    
        Michael_Brun
        
- 51
- 6
                    0
                    
            votes
                
                1 answer
            
        How can I alter this Shiny datatable to SQL update code for use with PostgresSQL?
I am currently working on a shiny application for work that is partially based off of this tutorial by Niels van der Velden. I am running into issues with the following code chunk:
observeEvent(input$submit_edit, priority = 20, {
SQL_df <-…
         
    
    
        Jon LLoyd
        
- 1
- 4