Ticket #41 (closed defect: fixed)
Single table non polymorphic inheritance clashes with autoload
| Reported by: | guest | Owned by: | ged |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.6 |
| Component: | core | Version: | 0.5.0 |
| Keywords: | Cc: |
Description
Both super and sub classes tries to load columns from the database, which results in column allready exist errors.
Reproducer:
create a table with:
sqlite3 test.sqlite 'CREATE TABLE main_father (id INTEGER PRIMARY KEY);'
test it with:
from elixir import * metadata.bind = "sqlite:///test.sqlite" options_defaults["polymorphic"] = False options_defaults["autoload"] = True class Father(Entity): pass class Son(Father): pass setup_all()
result:
$ python test.py
Traceback (most recent call last):
File "test.py", line 12, in ?
setup_all()
File "/usr/lib/python2.4/site-packages/elixir/__init__.py", line 116, in setup_all
setup_entities(entities)
File "/usr/lib/python2.4/site-packages/elixir/entity.py", line 731, in setup_entities
method()
File "/usr/lib/python2.4/site-packages/elixir/entity.py", line 177, in setup_autoload_table
self.setup_table(True)
File "/usr/lib/python2.4/site-packages/elixir/entity.py", line 250, in setup_table
self.parent._descriptor.add_column(col)
File "/usr/lib/python2.4/site-packages/elixir/entity.py", line 441, in add_column
raise Exception("Column '%s' already exist in '%s' ! " %
Exception: Column 'id' already exist in 'Father' !
Change History
Note: See
TracTickets for help on using
tickets.
