Ticket #86 (closed defect: worksforme)

Opened 4 years ago

Last modified 4 years ago

The handling of inherited columns with overridden column names is broken.

Reported by: guest Owned by:
Priority: normal Milestone:
Component: core Version:
Keywords: Cc:

Description

I have been able to use Concrete Inheritance (totally cognescent of the caveat above), however there is one issue: I was using column renaming and properties to do validation more frequently than on a commit, and discovered that, although the columns exist in the child table, they are only available under the column name, not the parent class's field name.

class Event(Entity):
    using_options(inheritance='concrete', tablename='__event')
    _start = Field(DateTime, required=True, colname='start')
    _finish = Field(DateTime, required=True, colname='finish')

There are then properties for start and finish...that use _start/_finish.

class Shift(Event):
    using_options(inheritance='concrete', shortnames=True)

In this class, accessing _start/_finish will throw an error:

AttributeError: Concrete Mapper|Shift|shift does not implement attribute '_start' 
at the instance level.  Add this property explicitly to Mapper|Shift|shift.

Removing the column renaming fixes the issue, but then I have ugly column names.

This bug relates to Ticket #10.

Attachments

test_concrete.py (0.8 kB) - added by ged 4 years ago.

Change History

Changed 4 years ago by ged

  • status changed from new to closed
  • resolution set to worksforme

Sorry for leaving this bug report open for so long... Your "testcase" works fine here (see attached script). I'm closing this bug now. If you can provide a runnable test case which still exhibit the problem, feel free to reopen the bug.

PS: please also specify which versions of Elixir and SQLAlchemy you are using.

Changed 4 years ago by ged

Note: See TracTickets for help on using tickets.