I am attempting to upgrade from sqlalchemy 0.3.11 to current release
0.4.1 and i am getting the following error:
/ recs = session.query(PurchaseOrder).filter_by(description =
'Shipped').all()
File "C:\Python24\Lib\site-packages\sqlalchemy\orm\query.py", line
322, in filter_by
clauses = [self._joinpoint.get_property(key,
resolve_synonyms=True).compare(operator.eq, value)
File "C:\Python24\Lib\site-packages\sqlalchemy\orm\mapper.py", line
192, in get_property
raise exceptions.InvalidRequestError("Mapper '%s' has no property
'%s'" % (str(self), key))
InvalidRequestError: Mapper 'Mapper|PurchaseOrder|purchaseorder' has
no property 'description'
/
I am trying to query a column in a related table with the following
query:
recs = session.query(PurchaseOrder).filter_by(description =
'Shipped').all()
This query works in 0.3.11.
Is there a new setting when defining relationships that I need to set
so that it looks at the related table columns when running a filter_by
or am i missing something simple?
Here is my simplified example classes, table definitions, and
mappings:
class PurchaseOrder(object) : pass
class OrderStatus(object) : pass
purchaseorder_table = sqlalchemy.Table(
'purchaseorder', metadata,
sqlalchemy.Column('id', sqlalchemy.Integer, primary_key=True),
sqlalchemy.Column('createdate', sqlalchemy.TIMESTAMP),
sqlalchemy.Column('statusid', sqlalchemy.Integer,
sqlalchemy.ForeignKey('testing.orderstatus.statusid')),
schema = 'testing')
orderstatus_table = sqlalchemy.Table( 'orderstatus',
metadata,
sqlalchemy.Column('statusid', sqlalchemy.Integer,
primary_key=True),
sqlalchemy.Column('description', sqlalchemy.VARCHAR),
schema = 'testing')
orm.mapper(PurchaseOrder,
purchaseorder_table,
properties={
'orderstatus' : orm.relation(OrderStatus)})
orm.mapper(OrderStatus,
orderstatus_table)
Thanks,
Curtis
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
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
-~----------~----~----~----~------~----~------~--~---