摘要:
示例1:
q = select([bmt_gene.c.id]).select_from(bmt_gene)
q = q.where(bmt_gene.c.ensembl_id == "ENSG00000000457")
print q
示例2:
from sqlalchemy import select, union
s1 = select([btm_gene.id, btm_gene.name]).select_from(btm_gene).where(btm_gene.name=='zhangsan').select()
s2 = select([btm_gene.id, btm_gene.name]).select_from(btm_gene).where(btm_gene.id.in_([5, 6, 9])).select()
result = db.session.execute(union(s1, s2)).fetchall()