I'm having another go at converting some sql to sqlalchemy:
select
count(distinct build.device_id)
from
channelbuild
join
build
on
build.id = channelbuild.build_id
where
channelbuild.channel_id = 9
and not
build.in_icp"""
I've got this far:
build = db.build
channelbuild = db.channelbuild
channelbuild\
.join((build, build.id == channelbuild.build_id))\
.filter(channelbuild.channel_id == 9)\
.filter(build.in_icp == False)\
.count()
But can't work out where to put the distinct, and what the syntax is
to tell it to use build.device_id
Cheers,
Stuart.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---