tidyverse / dbplyr

Database (DBI) backend for dplyr
https://dbplyr.tidyverse.org
Other
474 stars 173 forks source link

`head()` modifies `SELECT *` #1482

Open jonathanvoelkle opened 6 months ago

jonathanvoelkle commented 6 months ago

When using head() on a tbl, the select all statement is modified. Example below. In the example this is not a problem itself, but when calling tables in a specific schema, the name of the table is added, but the name of the schema is not. (I'm not quite sure for which backends this exactly is a problem.)

suppressMessages(library(dbplyr))
suppressMessages(library(dplyr, warn.conflicts = FALSE))
df <- memdb_frame(x = runif(26), y = runif(26))
df |> show_query()
#> <SQL>
#> SELECT *
#> FROM `dbplyr_98Ik9vEYQa`
df |> head() |> show_query()
#> <SQL>
#> SELECT `dbplyr_98Ik9vEYQa`.*
#> FROM `dbplyr_98Ik9vEYQa`
#> LIMIT 6

Created on 2024-03-22 with reprex v2.1.0