Collect both tables (admin & chg-log) from the DB, join them in a user view, and return all 3 tables in a list
cdr_pull_db_tbls.Rd
Collect both tables (admin & chg-log) from the DB, join them in a user view, and return all 3 tables in a list
Usage
cdr_pull_db_tbls(
conn_pool,
db_tbl_name,
chg_log_suffix = "_DELTAS",
key_field = "UID",
...
)
Arguments
- conn_pool
connection object (preferably a
pool::dbPool()
connection)- db_tbl_name
name of your primary table
- chg_log_suffix
name of your change-log table suffix
- key_field
column in the primary table that acts as the unique row identifier
- ...
other database pointer params like
schema
Examples
if (FALSE) {
con <- DBI::dbConnect(
drv = RPostgres::Postgres(),
dbname = "test",
host = "localhost",
user = Sys.getenv('postgres_username'),
password = Sys.getenv('postgres_password')
)
as_of <- lubridate::now()-lubridate::years(1)
DBI::dbListTables(con)
DBI::dbListObjects(con)
# both_tbls <- cdr_pull_db_tbls(con, db_tbl_name = 'iris', key_field = 'UID', schema = "test")
DBI::dbDisconnect(con)
}