Hi
Mapper.get_property doesn't behave as I'd expect it to, so I'd just
like to know if my understanding is incorrect. In the following
testcase I'd expect the first test to pass and the second to fail, but
I get the opposite. Thanks a lot.
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm.util import class_mapper
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.exc import InvalidRequestError
Base = declarative_base()
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
name = Column(String, key='name_key')
try:
class_mapper(User).get_property('name_key')
except InvalidRequestError:
print "error 1"
try:
class_mapper(User).get_property('name')
except InvalidRequestError:
print "error 2"
--
Eric Lemoine
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 96
Mail : [email protected]
http://www.camptocamp.com
--
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.