@Mike, Jonathan and Simon - Thank you so much for all your efforts. I hope
I can fix the problem soon in the dialect :-)
P.s. I have finally been able to generate the correct query, but now
currently the problem is that I get no result, although the query is
absolutely correct and should give back results.
Thats how I built the query now:
subquery = select([func.min(Partsupp.ps_supplycost)]).where(Part.p_partkey ==
Partsupp.ps_partkey).where(
Supplier.s_suppkey ==
Partsupp.ps_suppkey).where(Supplier.s_nationkey == Nation.n_nationkey).where(
Nation.n_regionkey ==
Region.r_regionkey).where(Region.r_name == 'EUROPE').correlate(Part)
q2 = session.query(Supplier.s_acctbal, Supplier.s_name, Nation.n_name,
Part.p_partkey, Part.p_mfgr,
Supplier.s_address, Supplier.s_phone,
Supplier.s_comment).filter(Part.p_partkey == Partsupp.ps_partkey,
Supplier.s_suppkey== Partsupp.ps_suppkey, Part.p_size == 15,
Part.p_type.like('%BRASS'),
Supplier.s_nationkey == Nation.n_nationkey,
Nation.n_regionkey == Region.r_regionkey,
Region.r_name == 'Europe', Partsupp.ps_supplycost ==
subquery).order_by(Supplier.s_acctbal.desc(),
Nation.n_name, Supplier.s_name, Part.p_partkey).limit(100)
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.