Here are the examples of the python api sqlalchemy.select.where.where.where taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
3
View Complete Implementation : welcome.py
Copyright Apache License 2.0
Author : Weasyl
Copyright Apache License 2.0
Author : Weasyl
def tag_update_insert(userid, submitid):
we = d.meta.tables['welcome']
db = d.connect()
q = sa.select([sa.exists(
sa.select([1])
.where(we.c.userid == userid)
.where(we.c.otherid == submitid)
.where(we.c.type == 3140))])
if db.scalar(q):
return
db.execute(
we.insert()
.values(userid=userid, otherid=submitid, unixtime=arrow.utcnow(), type=3140))
0
View Complete Implementation : test_compare.py
Copyright MIT License
Author : sqlalchemy
Copyright MIT License
Author : sqlalchemy
def _complex_fixtures():
def one():
a1 = table_a.alias()
a2 = table_b_like_a.alias()
stmt = (
select([table_a.c.a, a1.c.b, a2.c.b])
.where(table_a.c.b == a1.c.b)
.where(a1.c.b == a2.c.b)
.where(a1.c.a == 5)
)
return stmt
def one_diff():
a1 = table_b_like_a.alias()
a2 = table_a.alias()
stmt = (
select([table_a.c.a, a1.c.b, a2.c.b])
.where(table_a.c.b == a1.c.b)
.where(a1.c.b == a2.c.b)
.where(a1.c.a == 5)
)
return stmt
def two():
inner = one().subquery()
stmt = select([table_b.c.a, inner.c.a, inner.c.b]).select_from(
table_b.join(inner, table_b.c.b == inner.c.b)
)
return stmt
def three():
a1 = table_a.alias()
a2 = table_a.alias()
ex = exists().where(table_b.c.b == a1.c.a)
stmt = (
select([a1.c.a, a2.c.a])
.select_from(a1.join(a2, a1.c.b == a2.c.b))
.where(ex)
)
return stmt
return [one(), one_diff(), two(), three()]