Hello,
I'm trying to understand DBI better. I know that RPostgres is built on top of DBI, but when would I use one over the other in a connection string? In the RPostgres docs they just the DBI:: version, not sure why. I have normally used the RPostgres:: version at work.
For example:
con <- RPostgres::dbConnect(RPostgres::Postgres())
vs
con <- DBI::dbConnect(RPostgres::Postgres())
Both cases work as expected. If you were building a connection function based on the above code, which would you use and why?
Can you also generalize a connection function with DBI? In other words, could I create a function that would accept an RJDBC connection as well as a RPostgres connection where the SQL is exactly the same? This actually happens a lot at work where the same table is in 2 databases, but depending on your data science product, you may choose one over the other.
I hope this makes sense.