Skip to content

This transition guide is aimed at backend authors. dbplyr 2.0.0 is an important release for backends because it starts the process of moving all backend generics into dbplyr (instead of some living in dplyr). This move has been designed to occur in phases to avoid sudden breakages and give backend authors plenty of time to make changes.

The current timeline is something like this:

  • dbplyr 2.0.0 adds a new interface for database backends. The old interface remains so all existing backends continue to work, but new packages should use the new interface, and existing backends should start the update process.

  • dbplyr 2.2.0 (released >= 18 months dbplyr 2.0.0) deprecates the old interface, so that users are encouraged to upgrade backends.

  • dbplyr 2.3.0 (to be released >= 12 months after dbplyr 2.2.0) removes the old interface so user must upgrade backends.

  • A future version of dplyr will deprecate then remove the database generics.

Unused generics

A number of generics are no longer used so you can delete the corresponding methods:

Making these changes are important because they ensure your backend works consistently whether you use it through DBI or dplyr.

2nd edition

dbplyr 2.0.0 draws inspiration from the idea of an edition so that to tell dbplyr to use the new generics, you need to do two things:

  • Depend on dbplyr 2.0.0 in your DESCRIPTION, e.g. Imports: dbplyr (>= 2.0.0). This ensures that when someone installs your package they get the latest version of dbplyr.

  • Provide a method for the dbplyr_edition generic:

    #' @importFrom dbplyr dbplyr_edition
    #' @export
    dbplyr_edition.myConnectionClass <- function(con) 2L

    This tells dbplyr to use the new generics instead of the old generics.

Then you’ll need to update your methods, following the advice below.

SQL generation

There are a number of dplyr generics that generate then execute SQL. These have been replaced by dbplyr generics that just generate the SQL (and dbplyr takes care of executing it):

If you have methods for any of those generics, you’ll need to extract the SQL generation code into a new sql_ method.

New generics

You may also want to consider methods for the new generics in dbplyr 2.0.0: