I cannot connect postgresql schema.table with dplyr package

后端 未结 3 1143
陌清茗
陌清茗 2021-02-01 06:04

Im trying to connect postgres with dplyr functions

my_db <- src_postgres(dbname = \'mdb1252\', user = \"diego\", password = \"pass\")
my_db
src:  postgres 9.2         


        
3条回答
  •  清歌不尽
    2021-02-01 06:52

    Finally dplyr has the solution to this problem thanks to the latest version 0.7 recently announced by Hadley Wickham. The DBI and dbplyr libraries greatly simplified the connection between dplyr and PostgreSQL.

    con <- DBI::dbConnect(RPostgreSQL::PostgreSQL(), 
    host = "database.rstudio.com",
    user = "hadley",
    password = rstudioapi::askForPassword("Database password"))
    tbl <- dplyr::tbl(con, dbplyr::in_schema('mortalidad','def0307'))
    

提交回复
热议问题