#33451: queryset_object.query results does not add quotes around string values
-------------------------------------------+------------------------
               Reporter:  rajukumar-rjk    |          Owner:  (none)
                   Type:  Bug              |         Status:  new
              Component:  Error reporting  |        Version:  4.0
               Severity:  Normal           |       Keywords:
           Triage Stage:  Unreviewed       |      Has patch:  0
    Needs documentation:  0                |    Needs tests:  0
Patch needs improvement:  0                |  Easy pickings:  0
                  UI/UX:  0                |
-------------------------------------------+------------------------
 // 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.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33451>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/056.c4d61ad49f072486359128edba9f8c9d%40djangoproject.com.

Reply via email to