Open
Description
I would like to list tables in a specific schema using dbListTables
and use syntax that will work with other DBI backends that support listing tables in a schema (e.g. odbc).
library(DBI)
con <- DBI::dbConnect(RPostgres::Postgres(),
host = "localhost",
dbname = "cdm",
user = "postgres",
password = "",
port = 5432)
dbIsValid(con)
#> [1] TRUE
dbExecute(con, "create schema test;")
#> [1] 0
dbWriteTable(con, Id(schema = "test", table = "iris"), iris)
dbListTables(con)
#> character(0)
dbListTables(con, schema_name = "test")
#> character(0)
dbExecute(con, "SET search_path TO test")
#> [1] 0
dbListTables(con)
#> [1] "iris"
dbExecute(con, "drop schema test cascade")
#> NOTICE: drop cascades to table iris
#> [1] 0
dbDisconnect(con)
Created on 2022-07-08 by the reprex package (v2.0.1)