Changes between Initial Version and Version 1 of Ticket #25977


Ignore:
Timestamp:
Dec 23, 2015, 8:56:27 AM (8 years ago)
Author:
Tim Graham
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #25977

    • Property Component UncategorizedDatabase layer (models, ORM)
    • Property Type BugNew feature
  • Ticket #25977 – Description

    initial v1  
    11This is the query I that appears to be impossible to implement using the ORM:
    2 
     2{{{
    33SELECT id, name, start_date,
    44(SELECT count(state) FROM jobs_job WHERE  state = 'F' and job_group_id  = jg.id GROUP BY state) as badcount ,
    55(SELECT count(state) FROM jobs_job WHERE state = 'C'  and job_group_id  = jg.id GROUP BY state) as goodcount
    66FROM jobs_jobgroup as jg
    7 
    8 The main table represents a job group. The two queries tell how many successes and failures there are in the jobs for the job group. Currently, there is no way to have multiple aggregates with different filters on each one. You can't do annotate(fail_count=Count('job__state').filter(state='F'), good_count=Count('job__state').filter(state='C')) or something similar.
     7}}}
     8The main table represents a job group. The two queries tell how many successes and failures there are in the jobs for the job group. Currently, there is no way to have multiple aggregates with different filters on each one. You can't do `annotate(fail_count=Count('job__state').filter(state='F'), good_count=Count('job__state').filter(state='C'))` or something similar.
Back to Top