Open mgirlich opened 2 years ago
Thanks for raising this, good idea. For DBI you can create a class that inherits from the correct connection class, if necessary implement a dbSendQuery()
method that fails. Providing the mock class would be a job for the backend packages.
Does {dittodb} solve this?
For testing purposes it would be great to have something like a "virtual" connection. That is, a connection that can be created without actually connecting to a database. This connection could then be used in functions like
DBI::dbQuoteLiteral()
that don't need a live connection. Thedbplyr
package has something like this with thesimulate_*()
functions. This can be useful for testing when one cannot connect locally to a specific database. I also think/hope one could then get rid of some code duplication betweendbplyr
and the DBI packages, for example quoting literals is also defined indbplyr
.