just to note, I can't reproduce this, this would be a pretty basic failure as 
described, so I really need to see mappings and working code, and it certainly 
looks like something is making it do that for you, so really need to know what 
it is.    0.8.0 is going out very soon.  See below where I've tried to 
reproduce, also tried mysql dialect since that seems to be what you're using 
here:

from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

class A(Base):
    __tablename__ = "a"

    id = Column(Integer, primary_key=True)

class B(Base):
    __tablename__ = "b"

    id = Column(Integer, primary_key=True)
    a_id = Column(Integer, ForeignKey('a.id'))

s = Session()

a1 = aliased(A)
b1 = aliased(B)

print s.query(a1, b1).join(b1, a1.id == b1.a_id).filter(a1.id == 5)

# SELECT a_1.id AS a_1_id, b_1.id AS b_1_id, b_1.a_id AS b_1_a_id
# FROM a AS a_1 JOIN b AS b_1 ON a_1.id = b_1.a_id
# WHERE a_1.id = :id_1

# maybe a MySQL problem ?
from sqlalchemy.dialects import mysql
print s.query(a1, b1).join(b1, a1.id == b1.a_id).filter(a1.id == 5).\
            _compile_context().statement.compile(dialect=mysql.dialect())

# nope
# SELECT a_1.id AS a_1_id, b_1.id AS b_1_id, b_1.a_id AS b_1_a_id
# FROM a AS a_1 INNER JOIN b AS b_1 ON a_1.id = b_1.a_id
# WHERE a_1.id = %s

On Feb 15, 2013, at 10:13 AM, Michael Bayer <mike...@zzzcomputing.com> wrote:

> Can I please get mapper definitions for this so that I can actually run this 
> example, thanks.
> 
> Also make sure the issue still remains in current tip.
> 
> 
> On Feb 15, 2013, at 9:34 AM, Chris <chris.g....@gmail.com> wrote:
> 
>> Hi
>> 
>> The following fails to work in 0.8b2 (Works fine in 0.7.9)
>> 
>> pp = aliased(PublicationPrice, name="pp")
>> ppp= aliased(PublicationPrices, name="ppp")
>> 
>> session.query(pp, ppp).\
>>              join(ppp, ppp.id == pp.publicationpricesid).\
>>              filter(pp.publicationid == publicationid).all()
>> 
>> It generates the following SQL 
>> 
>> SELECT pp.id AS pp_id, pp.shopid AS pp_shopid, pp.publicationid AS 
>> pp_publicationid, pp.publicationpricesid AS pp_publicationpricesid, pp.dayid 
>> AS pp_dayid, pp.activedate AS pp_activedate, ppp.id AS ppp_id, ppp.shopid AS 
>> ppp_shopid, ppp.publicationid AS ppp_publicationid, ppp.barcodeid AS 
>> ppp_barcodeid, ppp.price AS ppp_price, ppp.onshelf AS ppp_onshelf, 
>> ppp.offshelf AS ppp_offshelf, ppp.ean_issue AS ppp_ean_issue, 
>> ppp.cover_issue AS ppp_cover_issue, ppp.dayid AS ppp_dayid, ppp.active AS 
>> ppp_active, ppp.startdate AS ppp_startdate, ppp.stopdate AS ppp_stopdate, 
>> ppp.cover_issue_next AS ppp_cover_issue_next, ppp.org_id AS ppp_org_id, 
>> ppp.vat AS ppp_vat, ppp.barcodeidfull AS ppp_barcodeidfull, ppp.activedate 
>> AS ppp_activedate, ppp.cost AS ppp_cost 
>> FROM publicationprice AS pp INNER JOIN publicationprices AS ppp ON 
>> publicationprices.id = pp.publicationpricesid 
>> WHERE pp.publicationid = %s
>> 
>> The "publicationprices.id" in the ON Clause of the inner join is incorrect 
>> it should be "ppp.id"
>> 
>> 
>> Chris
>> 
>> -- 
>> 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 sqlalchemy+unsubscr...@googlegroups.com.
>> To post to this group, send email to sqlalchemy@googlegroups.com.
>> Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
> 
> 
> -- 
> 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 sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to