I'm having a small issue with 0.9b1.  The example code below works for 
postgres, but fails with sqlite.  It does work for sqlite on 0.8.3.  It 
seems that the joinedload_all is causing something to reference the wrong 
alias.


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


engine = create_engine('sqlite://')
Base = declarative_base(bind=engine)
metadata = Base.metadata


account = Table('account', metadata,
    Column('account_id', Integer, key='id', primary_key=True),
    Column('name', String(255), nullable=False),
)

account_address_map = Table('account_address_map', metadata,
    Column('account_id', Integer, ForeignKey('account.id'), nullable=False),
    Column('address_id', Integer, ForeignKey('address.id'), nullable=False),
    Column('role_id', Integer, nullable=False)
)

address = Table('address', metadata,
    Column('address_id', Integer, key='id', primary_key=True),
    Column('address1', String(255), nullable=False),
)


mapping = account_address_map.select()\
    .where(account_address_map.c.role_id == 1)


class Account(Base):
    __table__ = account

    service_address = relationship('Address',
        secondary=mapping,
        uselist=False,
        viewonly=True)


class Address(Base):
    __table__ = address


metadata.create_all()
session = Session()
session.query(Account).options(joinedload_all('service_address')).all()

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to