Changes between Initial Version and Version 1 of Ticket #25705, comment 16
- Timestamp:
- Jul 15, 2024, 12:29:35 PM (4 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #25705, comment 16
initial v1 18 18 > Use the mogrify function in the first three backends, and manually quote the parameters in the other two. 19 19 20 I ''think'' that would qualify as a form of emulation or best-effort wouldn't it? What guarantees do we have that the quoting is appropriate for all datatypes that these backends support as parameters? Are we feeling confident, knowing that users will attempt to pipe `str(qs.query)` into `raw` and that `Query.__str__` always use `DEFAULT_DB_ALIAS` for compilation (even if the proper backend can often only be determined as execution time) that we are exposing the right tools to users and we can commit to them being safe for the years to come?20 I ''think'' that would qualify as a form of emulation or best-effort wouldn't it? What guarantees do we have that the quoting is appropriate for all datatypes that these backends support as parameters? Are we feeling confident, knowing that users will attempt to pipe `str(qs.query)` into `raw` and that `Query.__str__` always use `DEFAULT_DB_ALIAS` for compilation #25947 (even if the proper backend can often only be determined as execution time) that we are exposing the right tools to users and we can commit to them being safe for the years to come? 21 21 22 22 IMO the usage of `raw(str(qs.query))`, and the main motive for this ticket, is a symptom of a lack of documented way for safely building and executing the SQL and parameters from a `QuerySet` object which makes me believe the focus should be on documenting `queryset.qs.sql_with_params()` first instead?