Opened 3 years ago
Closed 3 years ago
#33451 closed Bug (duplicate)
queryset_object.query results does not add quotes around string values
Reported by: | Raju Kumar Singh | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 4.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
queryset
queryset = (FormDataValues.objects .filter(testing_cycle='BL') .values(location_name=F(location_name)) ) print(queryset.query)
result would be
SELECT `school`.`school_name` AS `location_name` FROM `form_data_values` WHERE ( `form_data`.`testing_cycle` = BL)
The result has a small issue, look at the value ("BL") that is being filtered, It is string so there should have been single quotes around it.
Many of occasions, I just paste the generated SQL in the MySQL editor but in order to run the whole SQL syntax I need to add quotes around the string values. This becomes a big issues with the complex sql.
Change History (1)
comment:1 by , 3 years ago
Component: | Error reporting → Database layer (models, ORM) |
---|---|
Owner: | set to |
Resolution: | → duplicate |
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Duplicate of #25705.