Skip to content

Message about check_from = FALSE cannot be suppressed in copy_to #1408

@marcusmunch

Description

@marcusmunch

As of v2.4.0, a message is shown if a table name contains a .. The message itself says that it may be suppressed with check_from = FALSE. However, passing this argument to dplyr::copy_to (even with check_from = TRUE, see reprex) causes an error.

library(dbplyr)

con <- DBI::dbConnect(drv = RSQLite::SQLite())

dplyr::copy_to(
  con,
  datasets::mtcars,
  name = DBI::Id(table = "temp.mtcars"),
  temporary = FALSE,
  overwrite = TRUE
)
#> It looks like you tried to incorrectly use a table in a schema as source.
#> ℹ If you want to specify a schema use `in_schema()` or `in_catalog()`.
#> ℹ If your table actually contains "." in the name use `check_from = FALSE` to
#>   silence this message.

dplyr::copy_to(
  con,
  datasets::mtcars,
  name = DBI::Id(table = "temp.mtcars"),
  temporary = FALSE,
  overwrite = TRUE,
  check_from = TRUE
)
#> Error in `db_copy_to()`:
#> ! Arguments in `...` must be used.
#> ✖ Problematic argument:
#> • check_from = TRUE
#> ℹ Did you misspell an argument name?
#> Backtrace:
#>      ▆
#>   1. ├─dplyr::copy_to(...)
#>   2. └─dplyr:::copy_to.DBIConnection(...)
#>   3.   ├─dplyr::copy_to(...)
#>   4.   └─dbplyr:::copy_to.src_sql(...)
#>   5.     └─dbplyr::db_copy_to(...)
#>   6.       └─rlang (local) `<fn>`()
#>   7.         └─rlang:::check_dots(env, error, action, call)
#>   8.           └─rlang:::action_dots(...)
#>   9.             ├─base (local) try_dots(...)
#>  10.             └─rlang (local) action(...)

Created on 2023-11-29 with reprex v2.0.2

As far as I can see the issue is caused by copy_to.src_sql returning the destination tbl_src_dbi without passing the check_from argument.
I have managed to fix the issue locally (4d23014), but as I am currently only able to test my solution for SQLite I am being a little extra cautious about opening PR's or anything.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions