I've attached a test script that illustrates a regression in the 0.8 branch
compared to the 0.7 branch.
I know the example doesn't make a lot of sense in its current form as I've
had to chop out tons of code to make it minimalistic. It appears that the
problem deals with specifying a key on a table column under certain
conditions. Removing the params statement in the query resolves the
problem (I know that the params don't make sense in this query, they do in
my production code). Also taking the key='id' off of product_offering_id
and changing the query accordingly resolves the issue.
So perhaps the params don't deal with column keys correctly?
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sqlalchemy/-/i1t3xnxH2wkJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
session = Session()
product_offering = Table('product_offering', Base.metadata,
Column('product_offering_id', Integer, key='id', primary_key=True),
Column('product_id', Integer, ForeignKey('product.id'), nullable=False)
)
class Product(Base):
__tablename__ = 'product'
id = Column(Integer, primary_key=True)
class ProductOffering(Base):
__table__ = product_offering
product = relationship(Product)
product_ids = select([Product.__table__.c.id])
q1 = (session.query(ProductOffering.id)
.filter(ProductOffering.product_id.in_(product_ids))
.params(zipcode='99999')
)
print str(q1)
ProductOffering.id.in_(q1)