Skip to content
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

using a where clause on a list with str_glue #576

Open
ChristelSwift opened this issue Nov 20, 2024 · 0 comments
Open

using a where clause on a list with str_glue #576

ChristelSwift opened this issue Nov 20, 2024 · 0 comments

Comments

@ChristelSwift
Copy link

ChristelSwift commented Nov 20, 2024

is it possible to use str_glue and have a WHERE clause on a list?

For example if my_list = c('apple', 'pear'),
how can i write the clause using
str_glue("select * from my_table where fruit in {my_list};")

without having to create the concatenated string myself with
my_list_str <- paste0("'", my_list, "'", collapse = ", ")?

Would it be possible to have the same syntax as there is in glue::glue_sql? ie using ({my_list*})?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant