Re: [sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-31 Thread Ladislav Lenart
Glad I could help, but I don't understand what is going on. Neither ticket description nor the patch itself helped me. Sorry. What is select_from() good for when it generates a cartesian query? What MIGHT help ME (a lot infact) is a couple of DOs and DONTs examples in one place for all these

Re: [sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-31 Thread Ladislav Lenart
Hello. I've read the patch and the new documentation and i've learned about the existence of select_entity_from(). I was trying to say that the new documentation does not help me to understand the meaning / preferred usage of these constructs (i.e. select_from, select_entity_from and aliased). I

Re: [sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-31 Thread Andrija Zarić
On Friday, May 31, 2013 11:46:46 AM UTC+2, Ladislav Lenart wrote: Glad I could help, but I don't understand what is going on. Neither ticket description nor the patch itself helped me. Sorry. What is select_from() good for when it generates a cartesian query? What MIGHT help ME (a lot

Re: [sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-31 Thread Andrija Zarić
On Fri, May 31, 2013 at 12:31 PM, Ladislav Lenart lenart...@volny.czwrote: Hello. I've read the patch and the new documentation and i've learned about the existence of select_entity_from(). I was trying to say that the new documentation does not help me to understand the meaning / preferred

Re: [sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-31 Thread Michael Bayer
On Friday, May 31, 2013 6:31:25 AM UTC-4, Ladislav Lenart wrote: Hello. I've read the patch and the new documentation and i've learned about the existence of select_entity_from(). I was trying to say that the new documentation does not help me to understand the meaning / preferred usage

Re: [sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-31 Thread Ladislav Lenart
Thank you for the excellent description. The replace in bold did the trick for me :-) Ladislav Lenart On 31.5.2013 16:31, Michael Bayer wrote: On Friday, May 31, 2013 6:31:25 AM UTC-4, Ladislav Lenart wrote: Hello. I've read the patch and the new documentation and i've

Re: [sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-30 Thread Ladislav Lenart
Hello. Sorry for the long delay. I finally had enough time to produce a minimal self-contained regression. The attached file produces the following SQL: WITH RECURSIVE q_cte(partner_id, max_depth) AS ( SELECT partner.id AS partner_id, 1 AS max_depth FROM partner WHERE

Re: [sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-30 Thread Michael Bayer
this is very helpful because you are here running into an older feature that I think is not very applicable to modern usage, not to mention not terrifically documented, so I've added http://www.sqlalchemy.org/trac/attachment/ticket/2736/ to address changing the role of select_from() to be more

[sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-10 Thread Ladislav Lenart
Hello. I get a warning like this: usr/lib/python2.7/dist-packages/sqlalchemy/sql/expression.py:2276: SAWarning: Column 'id' on table sqlalchemy.sql.expression.Select at 0xa3e19cc; Select object being replaced by another column with the same key. Consider use_labels for select() statements.

Re: [sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-10 Thread Michael Bayer
The Query usually does apply_labels automatically. if you are getting that warning with your query below, there's too much going on there for me to identify by sight where that might be happening, I would need actual code which I can run in order to diagnose. On May 10, 2013, at 11:10 AM,

Re: [sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-10 Thread Ladislav Lenart
Hello. My main concern was that the query creates a cartesian product and I thought the warning might have something to do with it. It haven't. The problem is related to the use of select_from(): q = session.query(cls, PersonalContact).select_from(q_cte_union) q = q.join(cls, cls.id ==

Re: [sqlalchemy] [Q][0.7.9] How to issue apply_labels() on an ORM query?

2013-05-10 Thread Michael Bayer
On May 10, 2013, at 3:03 PM, Ladislav Lenart lenart...@volny.cz wrote: Hello. My main concern was that the query creates a cartesian product and I thought the warning might have something to do with it. It haven't. The problem is related to the use of select_from(): q =