On 07/25/2016 12:23 AM, Ameretat Reith wrote:

mapper(Father1980,fathers,inherits=fathersMapper,
       polymorphic_identity='young-father')

you have the wrong table above ("fathers" and not "fathers80s").
There's a bug here in how the ORM is corrupting the table in response
to this which I'll fix separately.

I'm actually trying to map both `Father' and `Father1980' to the same
table, `fathers'.  Like [1] but without declarative API.  `fathers80s'
is here just to show separating tables solve the issue.

leave the table argument None on Father1980







File"/venv/lib/python2.7/site-packages/sqlalchemy/sql/expression.py",line
2737,incorresponding_column ifself.c.contains_column(column):


This is a very old version of SQLAlchemy, as starting with the 0.9
series the expression.py module was refactored to not be 4000 lines
long.   If you're doing new ORM development and not just maintaining
legacy code, I encourage you to upgrade to version 1.0.



It's traceback with 1.0.13:

```
Traceback (most recent call last):
  File "a.py", line 43, in <module>
    polymorphic_identity='young-father')
  File "<string>", line 2, in mapper
  File "/venv/lib/python2.7/site-packages/sqlalchemy/orm/mapper.py", line 627, 
in __init__
    self._configure_properties()
  File "/venv/lib/python2.7/site-packages/sqlalchemy/orm/mapper.py", line 1292, 
in _configure_properties
    self._adapt_inherited_property(key, prop, False)
  File "/venv/lib/python2.7/site-packages/sqlalchemy/orm/mapper.py", line 1514, 
in _adapt_inherited_property
    self._configure_property(key, prop, init=False, setparent=False)
  File "/venv/lib/python2.7/site-packages/sqlalchemy/orm/mapper.py", line 1541, 
in _configure_property
    prop.columns[0])
  File "/venv/lib/python2.7/site-packages/sqlalchemy/sql/selectable.py", line 
476, in corresponding_column
    if self.c.contains_column(column):
  File "/venv/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 
754, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "/venv/lib/python2.7/site-packages/sqlalchemy/sql/selectable.py", line 
553, in columns
    return self._columns.as_immutable()
AttributeError: 'Table' object has no attribute '_columns'
```

Thanks.

1:
http://docs.sqlalchemy.org/en/latest/orm/inheritance.html#single-table-inheritance


--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to