-
Notifications
You must be signed in to change notification settings - Fork 241
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
Support prepared statements in PEcAn.DB::db.query
#2317
Support prepared statements in PEcAn.DB::db.query
#2317
Conversation
Please correct text to “parameterized” statements and not prepared statements. Prepared statements are a different thing: https://www.postgresql.org/docs/9.3/sql-prepare.html |
@Chris-Schnaufer Wikipedia and the documentation for |
5f58388
to
e5fb356
Compare
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.
Would it make sense to deprecate RPostreSQL in favor of RPostgres?
I wouldn't do it until we give everyone a chance to run some tests. The fact that |
One thing I've thought about that could ease the transition is to add pseudo-support for parameterized statements in |
@ashiklom almost sounds like a summer of code project :) |
(NOTE: This PR is a superset of #2316. Merge/review that one first).
Description
Support prepared statements in
db.query
(if using theRPostgres
backend).Motivation and Context
Prepared statements provide a way to efficiently pass data into SQL queries without the risk of SQL injection attacks. Instead of doing this:
...we can now do this:
Besides preventing SQL injections, prepared statements also ensure that the input and target types are compatible.
Prepared statements provide an efficient way to operate on multiple values at once. For example, the following will return all the models whose revision is either "git", "46", or "unk":
...and here is an example of inserting multiple values of a given trait for a given species:
Prepared statements have been on our wishlist for a while (#395).
Review Time Estimate
Types of changes
Checklist: