Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. ## Connect to a local Postgres database running in a Docker container
  2. ## although the Docker part isn't of any importance here.
  3. ## Working with dplyr 0.7, DBI 0.7, dbplyr 1.1.0
  4.  
  5. library(DBI)
  6. library(dplyr)
  7. library(dbplyr)
  8.  
  9. con <- DBI::dbConnect(RPostgreSQL::PostgreSQL(), host = 'localhost', port = 8990,
  10. dbname = <name of db>, user = <user>, password = <pass>)
  11.  
  12. DBI::dbListTables(con)
  13.  
  14. deployments <- tbl(con, <name of table>)
  15. dbExistsTable(con, <name of table>)
  16.  
  17. t <- dbGetQuery(con, <name of table>)
  18.  
  19. dbDisconnect(con)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement