Hi Mike,

Brilliant thanks - that works - spent ages staring at it and missed
the second col.copy()!

Damian

On Oct 17, 6:27 pm, Michael Bayer <mike...@zzzcomputing.com> wrote:
> ah the example has a bug, you're hitting a second part of the code there 
> where it fetches columns that are placed on a single table child class that 
> are moved up to the parent.   Committing this now, here's a patch:
>
> diff -r 653ae7f17379 examples/versioning/history_meta.py
> --- a/examples/versioning/history_meta.py       Mon Oct 17 13:14:04 2011 -0400
> +++ b/examples/versioning/history_meta.py       Mon Oct 17 13:19:41 2011 -0400
> @@ -60,6 +60,7 @@
>          for column in local_mapper.local_table.c:
>              if column.key not in super_history_mapper.local_table.c:
>                  col = column.copy()
> +                col.unique = False
>                  super_history_mapper.local_table.append_column(col)
>          table = None
>
> this is rd87af238de36
>
> On Oct 17, 2011, at 12:56 PM, Damian wrote:
>
>
>
>
>
>
>
> > Hello!
>
> > I've run into an odd error whilst using the history meta.  I've got a
> > class which has two sub classes which define some additional columns.
> > The MainMeter class has a unique constraint on one of the colums.
> > When I have the history_meta create my history tables, the
> > trading_point_name column retains its unique constraint despite there
> > being a col.unique = False in the history meta which should disable
> > it.  I can't quite figure out why this is happening.  Any hints would
> > be appreciated!
>
> > class Meter(Base, BaseMixin):
> >    __metaclass__ = VersionedMeta
> >    __tablename__ = "meters"
>
> >    id = sa.Column(sa.Integer, primary_key=True)
> >    type = sa.Column(sa.Enum('main_meter', 'check_meter'))
> >    # and so forth....
>
> > class MainMeter(Meter):
> >    __mapper_args__ = {'polymorphic_identity': 'main_meter'}
> >    trading_point_name  = sa.Column(sa.Unicode(255), nullable=True,
> > unique=True)
> >    #and so forth....
>
> > class CheckMeter(Meter):
> >    __mapper_args__ = {'polymorphic_identity': 'check_meter'}
> >    #etc....
>
> > Details:
> > Sqlalchemy 7.3
> > Sqlite db backend
> > Python2.5
>
> > Best regards,
> > Damian
>
> > --
> > 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 
> > sqlalchemy+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/sqlalchemy?hl=en.

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to