sure, if you can file a ticket for that it would be helpful (assert
that primaryjoin/secondaryjoin are instances of ClauseElement).
On Jun 25, 2008, at 4:57 AM, Werner F. Bruhin wrote:
>
> I am changing my model to using "declarative".
>
> I am getting an exception "bool' object has no attribute
> '__visit_name__'" (full exception below) which was relatively
> difficult
> for me to trace down.
>
> The bool exception I get when I change this:
> vrecingrwfit = sao.relation('Vrecingrwfit', primaryjoin=
> (__table__.c.recipeid=='vrecingrwfit.fk_recipeid'),
> passive_deletes=True)
> to this:
> vrecingrwfit = sao.relation('Vrecingrwfit', primaryjoin=
> ('Recipe.recipeid'=='vrecingrwfit.fk_recipeid'),
> passive_deletes=True)
>
> It happens as I did not define the primaryjoin correctly.
> Correcting it to one string, i.e. removing the middle quotes fixed it:
> vrecingrwfit = sao.relation('Vrecingrwfit', primaryjoin=
> ('Recipe.recipeid==vrecingrwfit.fk_recipeid'),
> passive_deletes=True)
>
> May I suggest to change/improve the exception, i.e. give some pointer
> where in the model the problem is.
>
> Werner
>
>
> Traceback (most recent call last):
> File "saTest.py", line 42, in <module>
> x = session.query(dbmin.Prefminimal).get(1)
> File
> "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta1-py2.5.egg
> \sqlalchemy\orm\session.py",
> line 894, in query
> return self._query_cls(entities, self, **kwargs)
> File
> "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta1-py2.5.egg
> \sqlalchemy\orm\query.py",
> line 97, in __init__
> self.__setup_aliasizers(self._entities)
> File
> "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta1-py2.5.egg
> \sqlalchemy\orm\query.py",
> line 111, in __setup_aliasizers
> mapper, selectable, is_aliased_class = _entity_info(entity,
> ent.entity_name)
> File
> "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta1-py2.5.egg
> \sqlalchemy\orm\util.py",
> line 398, in _entity_info
> mapper = class_mapper(entity, entity_name, compile)
> File
> "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta1-py2.5.egg
> \sqlalchemy\orm\util.py",
> line 488, in class_mapper
> mapper = mapper.compile()
> File
> "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta1-py2.5.egg
> \sqlalchemy\orm\mapper.py",
> line 370, in compile
> mapper.__initialize_properties()
> File
> "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta1-py2.5.egg
> \sqlalchemy\orm\mapper.py",
> line 391, in __initialize_properties
> prop.init(key, self)
> File
> "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta1-py2.5.egg
> \sqlalchemy\orm\interfaces.py",
> line 378, in init
> self.do_init()
> File
> "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta1-py2.5.egg
> \sqlalchemy\orm\properties.py",
> line 510, in do_init
> self._determine_synchronize_pairs()
> File
> "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta1-py2.5.egg
> \sqlalchemy\orm\properties.py",
> line 605, in _determine_synchronize_pairs
> eq_pairs = criterion_as_pairs(self.primaryjoin,
> consider_as_foreign_keys=self._foreign_keys,
> any_operator=self.viewonly)
> File
> "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta1-py2.5.egg
> \sqlalchemy\sql\util.py",
> line 268, in criterion_as_pairs
> visitors.traverse(expression, {}, {'binary':visit_binary})
> File
> "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta1-py2.5.egg
> \sqlalchemy\sql\visitors.py",
> line 123, in traverse
> return traverse_using(iterate(obj, opts), obj, visitors)
> File
> "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta1-py2.5.egg
> \sqlalchemy\sql\visitors.py",
> line 115, in traverse_using
> meth = visitors.get(target.__visit_name__, None)
> AttributeError: 'bool' object has no attribute '__visit_name__'
>
>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---