Hello.
I don't know how to write the following query in SA (using constructs such as
query, select, exists):
SELECT EXISTS(
SELECT 1
FROM
imported_client_share
JOIN imported_partner_share ON imported_client_share.deal_id =
imported_partner_share.deal_id
JOIN deal
Hi,
I have an ORM class:
class Wineracku(DeclarativeBase, mix.StandardColumnMixin):
__tablename__ = u'wineracku'
description = sa.Column(sa.Unicode(length=30))
shortdesc = sa.Column(sa.Unicode(length=10))
# only used with single bottle type units
maxcol =
Hi,
Found it in the doc, the Adjacency List Relationship is what I wanted.
http://docs.sqlalchemy.org/en/latest/orm/relationships.html#adjacency-list-relationships
Werner
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To unsubscribe from this
we should probably add a method to Query called exists() that just turns any
query into EXISTS (SELECT 1), here's how to make it work for now
from sqlalchemy import exists
q1 = session.query(ImportedClientShare)
q1 = q1.join(ImportedPartnerShare,
ImportedClientShare.deal_id
Sorry, was out due to moving... BLEH.
I like second solution since I then don't need to declare the relationship
on every sub class.
Basicly:
1. Configure as I had previously
2. Make sure configure_mappers() is ran after all sub classes are
declared.
3. Monkey Wrench the base
Thank you!
I was missing the following bit(s):
q = session.query(
exists(q1.with_entities('1').statement)
| exists(q2.with_entities('1').statement)
)
I knew about Query.statement but I did not figure out how to combine that with
OR. It did not occur to me that I can