Ticket #41 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

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

Changed 5 years ago by ged

  • owner set to ged
  • status changed from new to accepted

Changed 5 years ago by ged

  • milestone set to 0.6

Changed 5 years ago by ged

  • status changed from accepted to closed
  • resolution set to fixed

fixed in r327, thanks for the report.

Note: See TracTickets for help on using tickets.