-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add support for fields with spaces in their names when using FROM clause #14
Comments
Hi @jimmyg3g, thanks for reporting this! This error was happening because of a problem in the queryparser package, which tidyquery depends on, and which I also maintain. I believe I have now resolved this in the development version of queryparser on GitHub. I have also made a change to queryparser that silences the numerous Please reinstall the development version of queryparser from GitHub and let me know if it works for you: remotes::install_github("ianmcook/queryparser") |
Yes, it works for me, thanks! |
The third example on this reprex is throwing an error: library(tidyverse)
library(tidyquery)
mtcars_tibble <- mtcars %>% rownames_to_column(var = 'brand and model') %>%
as_tibble()
query('SELECT mt.`brand and model` FROM mtcars_tibble as mt LIMIT 1')
#> # A tibble: 1 x 1
#> `brand and model`
#> <chr>
#> 1 Mazda RX4
query("SELECT SUBSTRING_INDEX(`brand and model`, ' ', 1) as brand from mtcars_tibble LIMIT 1")
#> # A tibble: 1 x 1
#> brand
#> <chr>
#> 1 Mazda
query("SELECT SUBSTRING_INDEX(mt.`brand and model`, ' ', 1) as brand from mtcars_tibble as mt LIMIT 1")
#> Error in str2lang(expr_out): <text>:1:20: unexpected symbol
#> 1: SUBSTRING_INDEX(mt.`brand and model`
#> ^ Created on 2020-08-18 by the reprex package (v0.3.0.9001) |
Oops, didn't catch that case. I just fixed it. The version of queryparser on GitHub should solve this for you. |
That did the trick, thanks! |
I inherited a bunch of SQL with spaces in field names. Does tidyquery support field names that have spaces like
brand and model
in this reprex:Created on 2020-08-11 by the reprex package (v0.3.0.9001)
The text was updated successfully, but these errors were encountered: