stringr icon indicating copy to clipboard operation
stringr copied to clipboard

using a where clause on a list with str_glue

Open ChristelSwift opened this issue 1 year ago • 0 comments

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*})?

ChristelSwift avatar Nov 20 '24 16:11 ChristelSwift