-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
Change to all-parametrised queries #81
Comments
Started this at kayak/pypika#201 |
Just ran into a problem with the GIS work that this should solve. Unless I am mistaken this will have the side-effect of allowing us to use pypika function objects in queries as well since pypika should properly handle converting them to raw sql. Practically everything in GIS is done via SQL functions and currently if you pass them in to the sql driver Although re-running a query with a mixture of functions and raw sql parameters may cause problems because of the |
Hmm, I think this will help for any non-text object. Pypika has a I also think #72 and 'capabilities' would probably be needed to make the GIS implementation not feel hacky. |
PyPika 0.22 is released with |
Progress on #81 This PR adds capability to allow parameterd queries, and then connects it up for Updates(.save()) and Deletes. (Not queryset updates, that is a separate issue). This is a step towards hardening Tortoise ORM. It also SIGNIFICANTLY improves performance for full Updates, partial Updates and Deletes.
v0.16.6 fixed some SQL injection issues for MySQL. |
Is your feature request related to a problem? Please describe.
Two actually:
Describe the solution you'd like
Update PyPika to allow parametrised queries.
Describe alternatives you've considered
There isn't really. Build our own is too much work for negative gain.
Additional context
We can't guarantee that parameters will be presented in the SQL query in the order we specify, so I feel the simplest solution might be to send the parameters as per usual, but then have a
to_parametrised_query()
method that returns (str, query parameter objects) so we can use parametrised queries, and PyPika is then in charge of managing order.Then we need to update our code to use the parameters.
Done:
BinaryField
LIKE
The text was updated successfully, but these errors were encountered: