-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dbplyr 2.4.0 - table aliases with in_schema now break queries #1404
Comments
Are you sure this is due to library(sparklyr)
library(dplyr)
sc <- spark_connect(master = "local")
iris_tbl <- copy_to(sc, iris, overwrite = TRUE)
iris_tbl %>%
head(5)
#> # Source: spark<?> [?? x 5]
#> Sepal_Length Sepal_Width Petal_Length Petal_Width Species
#> <dbl> <dbl> <dbl> <dbl> <chr>
#> 1 5.1 3.5 1.4 0.2 setosa
#> 2 4.9 3 1.4 0.2 setosa
#> 3 4.7 3.2 1.3 0.2 setosa
#> 4 4.6 3.1 1.5 0.2 setosa
#> 5 5 3.6 1.4 0.2 setosa
iris_tbl %>%
head(5) %>%
show_query()
#> <SQL>
#> SELECT `iris`.*
#> FROM `iris`
#> LIMIT 5 Created on 2023-11-10 with reprex v2.0.2 Can you please add a reprex? |
Apologies, had a deeper dive and believe the issue is to do with the interaction between library(dplyr)
library(dbplyr)
x <- c("abc", "def", "ghif")
table <- in_schema("schema", c("alias" = "table"))
# works as generates SELECT *
lazy_frame(x = x, con = simulate_odbc(), .name = table) %>%
show_query()
#> <SQL>
#> SELECT *
#> FROM `schema`.`table`
# breaks as generates SELECT `table`.* but with FROM `schema`.`table` AS `alias`
lazy_frame(x = x, con = simulate_odbc(), .name = table) %>%
head(5) %>%
show_query()
#> <SQL>
#> SELECT `table`.*
#> FROM `schema`.`table` AS `alias`
#> LIMIT 5 Do you want me to open a new issue or rename this one? |
in_schema
now break queries
in_schema
now break queries
@MKatz-DHSC Are you deliberately or accidentally passing a named vector to |
The unexpected behaviour occurred when I was indexing a named vector of table names as part of a loop with |
Ok, just wanted to double check that the expected behaviour here is to drop the names. |
Yep, can't really see a use case where you would want to manually specify the alias name. Thanks for looking into this. |
New behaviour of prefixing * with the table name breaks Spark ODBC queries, is it possible to override this behaviour?
The text was updated successfully, but these errors were encountered: