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

sqlInterpolate not working with IN #259

Closed
renkun-ken opened this issue Sep 18, 2018 · 2 comments
Closed

sqlInterpolate not working with IN #259

renkun-ken opened this issue Sep 18, 2018 · 2 comments

Comments

@renkun-ken
Copy link
Contributor

The following interpolation does not seem to be supported currently:

sqlInterpolate(con, "select * from table where name in ?names", names = c("name1", "name2"))

which is supposed to be translated into

select * from table where name in ('name1','name2')
@krlmlr
Copy link
Member

krlmlr commented Oct 1, 2018

You still can use SQL():

library(DBI)
sqlInterpolate(
  ANSI(),
  "select * from table where name in ?names",
  names = SQL("('a', 'b')")
)
#> <SQL> select * from table where name in ('a', 'b')

Created on 2018-10-01 by the reprex package (v0.2.1.9000)

Would you like to add documentation and/or a test?

@renkun-ken
Copy link
Contributor Author

@krlmlr Thanks! I file an PR to add documentation and a test for this.

krlmlr added a commit that referenced this issue Oct 4, 2018
- Add usage of `SQL()` to `sqlInterpolate()` examples (#259, @renkun-ken).
@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants