I cannot connect postgresql schema.table with dplyr package

后端 未结 3 1142
陌清茗
陌清茗 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:50

    If anybody ends up here with the same problem, here is what works for me: (taken from @Diego's comment from Feb 6'14)

    postgre_table <- function (src, schema, table) {
      paste('SELECT * FROM', paste(schema, table, sep = '.')) %>% 
        sql() %>% tbl(src = src)
    }
    

提交回复
热议问题