#30224: Mysql Datetime value is string instead of datetime object
-------------------------------------+-------------------------------------
     Reporter:  Martin Kuhn          |                    Owner:  Rohit Jha
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  Mysql                |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Rohit Jha):

 I am trying to recreate this issue, I have written a (test
 
case)[https://github.com/django/django/compare/master...rohitjha941:ticket_30224]
 which generates the following query:


 {{{
 SELECT "expressions_experiment"."id",
        "expressions_experiment"."name",
        "expressions_experiment"."assigned",
        "expressions_experiment"."completed",
        "expressions_experiment"."estimated_time",
        "expressions_experiment"."start",
        "expressions_experiment"."end",
        Min(CASE
              WHEN "expressions_result"."experiment_id" = 1 THEN
              "expressions_result"."result_time"
              ELSE NULL
            END) AS "min_expiry_date"
 FROM   "expressions_experiment"
        LEFT OUTER JOIN "expressions_result"
                     ON ( "expressions_experiment"."id" =
                          "expressions_result"."experiment_id" )
 GROUP  BY "expressions_experiment"."id",
           "expressions_experiment"."name",
           "expressions_experiment"."assigned",
           "expressions_experiment"."completed",
           "expressions_experiment"."estimated_time",
           "expressions_experiment"."start",
           "expressions_experiment"."end"

 }}}

 and output is
 {{{
   [{'id': 1, 'name': 'Rohit', 'assigned': datetime.date(2020, 3, 1),
 'completed': datetime.date(2020, 3, 21), 'estimated_time':
 datetime.timedelta(days=20, seconds=36000), 'start':
 datetime.datetime(2020, 3, 1, 11, 23, 36, 34995), 'end':
 datetime.datetime(2020, 3, 21, 21, 23, 36, 34998), 'min_expiry_date':
 datetime.datetime(2020, 4, 20, 21, 23, 36, 35778)}]
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30224#comment:15>
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/065.6f1f0595fa540738bb32a6f3fb6320ea%40djangoproject.com.

Reply via email to