I just upgraded to 0.4.2, and tried to take advantage of the fix
available, but I'm confused. I have this code:

mapper(Resource, resources,
    polymorphic_on=resources.c.type,
    polymorphic_identity="empty",
    column_prefix='_',
    properties={
        'id': resources.c.id,
        'url': synonym('_url', map_column=True),
        'children': relation(Resource, backref=backref("_parent",
 
remote_side=[resources.c.id])),
        'parent': synonym('_parent', map_column=True),
        'name': synonym('_name', map_column=True),
        'type': resources.c.type,
        # NOTE: Remember to add here other columns that don't need
        # a custom property accessor, like the id. Otherwise, they
        # be available as _column_name, not column_name.
    },
    save_on_init=False,
)

Each of (url, parent, name) is a property in my class, as such:

class Resource(object):
    def _get_url(self):
        """My docstring"""
        return self._url
    def _set_url(self, url):
        self._url = url
    url = property(_get_url, _set_url)

Of course, the logic in the property code is much more complex than
that.

But when I try to import that module, it says this:

[...]
File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.4.2-py2.5.egg/
sqlalchemy/orm/mapper.py", line 685, in _compile_property
raise exceptions.ArgumentError("Can't compile synonym '%s': no column
on table '%s' named '%s'"  % (prop.name,
self.select_table.description, key))
sqlalchemy.exceptions.ArgumentError: Can't compile synonym '_parent':
no column on table 'resources' named 'parent'

It seems that the problem is _only_ with 'parent'.

Any ideas? And by the way, what does map_column do?

Thanks.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to