Skip to content

Commit

Permalink
Deprecate tbl_sql(check_from)
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Feb 20, 2024
1 parent f3bc84a commit 271617a
Show file tree
Hide file tree
Showing 16 changed files with 234 additions and 14 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ importFrom(dplyr,ungroup)
importFrom(dplyr,union)
importFrom(dplyr,union_all)
importFrom(glue,glue)
importFrom(lifecycle,deprecated)
importFrom(magrittr,"%>%")
importFrom(methods,initialize)
importFrom(pillar,align)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

* If you accidentally pass a named vector to any of the database identifer
functions, those names will be automatically stripped (#1404).

* `tbl_sql(check_from)` is now deprecated.

* When dbplyr creates an index on a table in a schema (e.g. `schema.table`),
it now only includes the table name in the index name, not the schema name.
Expand Down
1 change: 1 addition & 0 deletions R/dbplyr.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
#' @import DBI
#' @importFrom tibble tibble as_tibble
#' @importFrom magrittr %>%
#' @importFrom lifecycle deprecated
#' @keywords internal
"_PACKAGE"
13 changes: 11 additions & 2 deletions R/tbl-sql.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,20 @@
#' to avoid retrieving them from the database.
#' Mainly useful for better performance when creating
#' multiple `tbl` objects.
#' @param check_from Check if `from` is likely misspecified SQL or a table in a schema.
tbl_sql <- function(subclass, src, from, ..., vars = NULL, check_from = TRUE) {
#' @param check_from `r lifecycle::badge("deprecated")`
tbl_sql <- function(subclass,
src,
from,
...,
vars = NULL,
check_from = deprecated()) {
# Can't use check_dots_used(), #1429
check_character(vars, allow_null = TRUE)

if (lifecycle::is_present(check_from)) {
lifecycle::deprecate_warn("2.5.0", "tbl_sql(check_from)")
}

from <- as_table_source(from, con = src$con)
vars <- vars %||% dbplyr_query_fields(src$con, from)

Expand Down
22 changes: 21 additions & 1 deletion man/figures/lifecycle-archived.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 21 additions & 1 deletion man/figures/lifecycle-defunct.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 21 additions & 1 deletion man/figures/lifecycle-deprecated.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 21 additions & 1 deletion man/figures/lifecycle-experimental.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 21 additions & 1 deletion man/figures/lifecycle-maturing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 21 additions & 1 deletion man/figures/lifecycle-questioning.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 21 additions & 1 deletion man/figures/lifecycle-soft-deprecated.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 271617a

Please sign in to comment.