diff --git a/NAMESPACE b/NAMESPACE
index 79b18ef8a..149d26fda 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -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)
diff --git a/NEWS.md b/NEWS.md
index e73b501e4..148bac874 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -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.
diff --git a/R/dbplyr.R b/R/dbplyr.R
index 08e05f67e..46536614b 100644
--- a/R/dbplyr.R
+++ b/R/dbplyr.R
@@ -7,5 +7,6 @@
#' @import DBI
#' @importFrom tibble tibble as_tibble
#' @importFrom magrittr %>%
+#' @importFrom lifecycle deprecated
#' @keywords internal
"_PACKAGE"
diff --git a/R/tbl-sql.R b/R/tbl-sql.R
index fd93ccc9e..ef27ac25b 100644
--- a/R/tbl-sql.R
+++ b/R/tbl-sql.R
@@ -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)
diff --git a/man/figures/lifecycle-archived.svg b/man/figures/lifecycle-archived.svg
index 48f72a6f3..745ab0c78 100644
--- a/man/figures/lifecycle-archived.svg
+++ b/man/figures/lifecycle-archived.svg
@@ -1 +1,21 @@
-
\ No newline at end of file
+
diff --git a/man/figures/lifecycle-defunct.svg b/man/figures/lifecycle-defunct.svg
index 01452e5fb..d5c9559ed 100644
--- a/man/figures/lifecycle-defunct.svg
+++ b/man/figures/lifecycle-defunct.svg
@@ -1 +1,21 @@
-
\ No newline at end of file
+
diff --git a/man/figures/lifecycle-deprecated.svg b/man/figures/lifecycle-deprecated.svg
index 4baaee01c..b61c57c3f 100644
--- a/man/figures/lifecycle-deprecated.svg
+++ b/man/figures/lifecycle-deprecated.svg
@@ -1 +1,21 @@
-
\ No newline at end of file
+
diff --git a/man/figures/lifecycle-experimental.svg b/man/figures/lifecycle-experimental.svg
index d1d060e92..5d88fc2c6 100644
--- a/man/figures/lifecycle-experimental.svg
+++ b/man/figures/lifecycle-experimental.svg
@@ -1 +1,21 @@
-
\ No newline at end of file
+
diff --git a/man/figures/lifecycle-maturing.svg b/man/figures/lifecycle-maturing.svg
index df7131014..897370ecf 100644
--- a/man/figures/lifecycle-maturing.svg
+++ b/man/figures/lifecycle-maturing.svg
@@ -1 +1,21 @@
-
\ No newline at end of file
+
diff --git a/man/figures/lifecycle-questioning.svg b/man/figures/lifecycle-questioning.svg
index 08ee0c903..7c1721d05 100644
--- a/man/figures/lifecycle-questioning.svg
+++ b/man/figures/lifecycle-questioning.svg
@@ -1 +1,21 @@
-
\ No newline at end of file
+
diff --git a/man/figures/lifecycle-soft-deprecated.svg b/man/figures/lifecycle-soft-deprecated.svg
index 9f014fd19..9c166ff30 100644
--- a/man/figures/lifecycle-soft-deprecated.svg
+++ b/man/figures/lifecycle-soft-deprecated.svg
@@ -1 +1,21 @@
-
\ No newline at end of file
+
diff --git a/man/figures/lifecycle-stable.svg b/man/figures/lifecycle-stable.svg
index e015dc811..9bf21e76b 100644
--- a/man/figures/lifecycle-stable.svg
+++ b/man/figures/lifecycle-stable.svg
@@ -1 +1,29 @@
-
\ No newline at end of file
+
diff --git a/man/figures/lifecycle-superseded.svg b/man/figures/lifecycle-superseded.svg
index 75f24f553..db8d757f7 100644
--- a/man/figures/lifecycle-superseded.svg
+++ b/man/figures/lifecycle-superseded.svg
@@ -1 +1,21 @@
-
\ No newline at end of file
+
diff --git a/man/tbl_sql.Rd b/man/tbl_sql.Rd
index c06db873a..dd6d9fa15 100644
--- a/man/tbl_sql.Rd
+++ b/man/tbl_sql.Rd
@@ -4,7 +4,7 @@
\alias{tbl_sql}
\title{Create an SQL tbl (abstract)}
\usage{
-tbl_sql(subclass, src, from, ..., vars = NULL, check_from = TRUE)
+tbl_sql(subclass, src, from, ..., vars = NULL, check_from = deprecated())
}
\arguments{
\item{subclass}{name of subclass}
@@ -16,7 +16,7 @@ to avoid retrieving them from the database.
Mainly useful for better performance when creating
multiple \code{tbl} objects.}
-\item{check_from}{Check if \code{from} is likely misspecified SQL or a table in a schema.}
+\item{check_from}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}}
}
\description{
Generally, you should no longer need to provide a custom \code{tbl()}
diff --git a/tests/testthat/_snaps/tbl-sql.md b/tests/testthat/_snaps/tbl-sql.md
index 7b9b38a82..d07493dc3 100644
--- a/tests/testthat/_snaps/tbl-sql.md
+++ b/tests/testthat/_snaps/tbl-sql.md
@@ -11,3 +11,15 @@
2 2 2
3 3 1
+# check_from is deprecated
+
+ Code
+ tbl(con, "x", check_from = FALSE)
+ Condition
+ Warning:
+ The `check_from` argument of `tbl_sql()` is deprecated as of dbplyr 2.5.0.
+ Output
+ # Source: table<`x`> [0 x 1]
+ # Database: sqlite 3.45.0 [:memory:]
+ # i 1 variable: y
+
diff --git a/tests/testthat/test-tbl-sql.R b/tests/testthat/test-tbl-sql.R
index 5177faaff..01c8bd948 100644
--- a/tests/testthat/test-tbl-sql.R
+++ b/tests/testthat/test-tbl-sql.R
@@ -50,10 +50,17 @@ test_that("can distinguish 'schema.table' from 'schema'.'table'", {
DBI::dbExecute(con, "CREATE TABLE 'aux.t1' (a, b, c)")
expect_equal(as.character(tbl_vars(tbl(con, in_schema("aux", "t1")))), c("x", "y", "z"))
- df <- tbl(con, ident("aux.t1"), check_from = FALSE)
+ df <- tbl(con, ident("aux.t1"))
expect_equal(as.character(tbl_vars(df)), c("a", "b", "c"))
})
+test_that("check_from is deprecated", {
+ con <- local_sqlite_connection()
+ DBI::dbExecute(con, "CREATE TABLE x (y)")
+
+ expect_snapshot(tbl(con, "x", check_from = FALSE))
+})
+
# n_groups ----------------------------------------------------------------
test_that("check basic group size implementation", {