-
-
Notifications
You must be signed in to change notification settings - Fork 878
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
Use parameterised query option in SQL chunk #1987
Conversation
…nt into the `DBI::dbGetQuery()` and interplation results will be bypassed.
@cderv I have tried this on my version of It seems like quite a small change, but number of I would also recommend to deprecate DBI interpolation of parameters gradually for databases that support parameterised queries. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
but number of
if
statements that sql engine has is slightly dangerous
That's true :)
I don't think
eng_sql()
function has any tests right now.
Currently this is our only test: https://github.com/yihui/knitr-examples/blob/master/115-engine-sql.Rmd
I would also recommend to deprecate DBI interpolation of parameters gradually for databases that support parameterised queries.
That sounds like a good plan to me (but again, I don't think I have enough expertise to make the decision).
I have checked sqlite documentation and it supports e.g.:
I will later update examples file with the params options, so we have some test coverage for that. Not sure how these two repositories sync, possibly I should wait till this is merged? |
Yeah, in fact they are not really sync between PR but are on master. I need to improve that and implement an integration workflow for such cases. But you can still open a PR in knitr-example if you want to share / save your example file. I'll have a look soon at this. You example file could help me for the review. Thanks. |
@cderv I have added example to I am not sure how you generate It would be also helpful to update README with the method used to generate md for future contributors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR can be merged after you add an item to NEWS.md (unless @cderv has any other feedback). Also feel free to add your name to DESCRIPTION
as ctb
. Thanks!
It would be also helpful to update README with the method used to generate md for future contributors.
There is an ugly shell script k
in the repo, and the examples are knitted with this shell script, e.g., ./k 115-engine-sql.Rmd
. Before documenting it in README, we'll need to make it less ugly :)
That is ok with me. We should also update the documentation for the SQL engine in different places now so that this is documented.
Yes this workflow of adding test in knitr-example should be improved - and documented / automated at the right level. Currently it is not easy to setup - I had a hard time doing it if I remember correctly :) |
@yihui I have added a line to NEWS and added myself to DESCRIPTION. Thank you for helping with this, looking forward to using this in my projects ) |
closes #1867