Python 如何将SQL查询转换为Django ORM?
这是我想更改为Django ORM的SQL查询,请帮助 你可以。Python 如何将SQL查询转换为Django ORM?,python,django,orm,django-orm,Python,Django,Orm,Django Orm,这是我想更改为Django ORM的SQL查询,请帮助 你可以。 select 0 'bucket_id', 'Incomplete' as 'name', count(*) 'user_count' from user_smartreq where job_id = {job_id} and pred_perf is null union select 1 'bucket_id', 'Very Poor' as 'name', c
select 0 'bucket_id', 'Incomplete' as 'name', count(*) 'user_count'
from user_smartreq where job_id = {job_id} and pred_perf is null
union
select 1 'bucket_id', 'Very Poor' as 'name', count(*) 'user_count'
from user_smartreq where job_id = {job_id} and pred_perf between 0 and 1.999
union
select 2 'bucket_id', 'Poor' as 'name', count(*) 'user_count'
from user_smartreq where job_id = {job_id} and pred_perf between 2 and 2.999
union
select 3 'bucket_id', 'OK' as 'name', count(*) 'user_count'
from user_smartreq where job_id = {job_id} and pred_perf between 3 and 3.999
union
select 4 'bucket_id', 'Good' as 'name', count(*) 'user_count'
from user_smartreq where job_id = {job_id} and pred_perf between 4 and 4.599
union
select 5 'bucket_id', 'Great' as 'name', count(*) 'user_count'
from user_smartreq where job_id = {job_id} and pred_perf between 4.599 and 5