dplyr icon indicating copy to clipboard operation
dplyr copied to clipboard

Move database generics to dbplyr

Open hadley opened this issue 4 years ago • 6 comments

Deprecate database generics, following strategy in https://github.com/tidyverse/design/issues/106. Then remove tests, since they should live in dbplyr.

https://github.com/tidyverse/dbplyr/issues/385 needs to happen first.

Remove

setOldClass(c("sql", "character"))
setOldClass(c("ident", "sql", "character"))

hadley avatar Dec 13 '19 16:12 hadley

Also need to remove sql() and ident() (#4434), and src_dbi() and friends (#4431)

And from #4542

  • Deprecate src_postgres(), src_mysql(), and src_sqlite(). The database dependencies will need to stay in suggests until these functions can be made defunct, which is probably 2021 at the earliest.

  • Remove ident() and sql() — the chance of using these before calling one of the src_ functions is slim, so you should already be notified.

  • Figure out what do to with tbl.DBIConnection() and copy_to.DBIConnection(). They at least need to go to

  • Ensure the check_dbplyr() asserts needed version.

  • Review documentation to remove examples and ensure the user is pointed firmly towards dbplyr.

  • Remove last use of Lahman package

  • Update reference index

hadley avatar Dec 31 '19 17:12 hadley

For dplyr 1.0.0 I will:

  • Deprecate src_postgres(), src_mysql(), and src_sqlite(). The database dependencies will need to stay in suggests until these functions can be made defunct, which is probably 2021 at the earliest.

  • Remove the setOldClass() definitions

hadley avatar Mar 05 '20 23:03 hadley

Now have a new plan for this where the generics no longer need to move; but we will need to eventually deprecate and then remove the database generics here. See details in https://dbplyr.tidyverse.org/articles/backend-2.html

hadley avatar Nov 16 '20 20:11 hadley

Need to break this up into smaller issues — I need to analyse this carefully but after #6367, I think all that needs to be done is to deprecate then remove the db_*/sql_* generics. Will need to leave copy_to and tbl methods in dplyr, so existing code keeps working without first loading dbplyr.

hadley avatar Jul 26 '22 11:07 hadley

Also need to rename all db files consistently:

# compat-db.R -> ?
# compute-collect.r -> db-compute-complete.R
# copy-to.r -> db-copy-to.R
# dbplyr.r -> db-generics.R
# deprec-dbi -> ?
# explain.R -> db-explain.R
# order-by -> db-order-by
# src_dbi.R -> db-src.R
# src.R -> db-src.R

And plan for shifting all dbplyr generics (e.g. sql, ident, show_query, src, is.src, same_src, auto_copy, explain) in dbplyr.

@krlmlr's process for pillar/tibble

  • in downstream:
    • implement the generic, export it
    • in .onLoad() or equivalent, overwrite generic with upstream::generic if it still exists there
    • copy default methods from upstream without adding @export
    • register methods if they aren't registered yet, I used the naming convention ..._if_..._hasnt or ..._if_..._has, I'll need to dig up that code if needed
    • release
  • in upstream
    • remove generic and default methods
    • revdepcheck, alert downstream maintainers
    • wait if needed
    • release
  • in downstream
    • remove compatibility code
    • release

Will probably need to update advice in https://dbplyr.tidyverse.org/articles/backend-2.html.

hadley avatar Aug 19 '22 12:08 hadley

Need to start by re-doing #6367 when we have an appetite for more revdep breakages.

hadley avatar Jan 17 '23 15:01 hadley