"allow_column_override" is gone in version 0.5 - you should never use
this option. the issue is that you are naming a relation() the same
as a column in your table, a column which is required for that
relation() to function. Every column and relation on a mapper needs
to have a distinct name. if you'd like to call your relation()
'evidence', map the 'evidence' column explicitly using a different
name such as '_evidence' -
properties={'_evidence':in_table.c.evidence} .
On Dec 17, 2008, at 6:37 AM, Nathan Harmston wrote:
> Hi everyone ,
>
> I have the following setup (snipped):
>
> in_table = Table('in', metadata,
> Column('id', Integer, primary_key=True),
> Column('pA', String(6), ForeignKey('p.id'),
> nullable=False),
> Column('pB', String(6), ForeignKey('p.id'),
> nullable=False),
> Column('evidence', Integer,
> ForeignKey('documents.id'), nullable=False)
> )
> mapper(Paper, document_table, properties={'authors':relation(Author,
> secondary=papers_to_authors_table, backref='publications')})
> mapper(Author, authors_table)
> mapper(Ent, p_table)
> mapper(Cooccurrence, in_table,
> properties={ 'evidence':relation(Paper) })
>
> I can't seem to get the last mapper to work and I get the following
> exception:
>
> raise exceptions.ArgumentError("WARNING: column '%s' not being
> added due to property '%s'. Specify 'allow_column_override=True' to
> mapper() to ignore this condition." % (column.key, repr(prop)))
> sqlalchemy.exceptions.ArgumentError: WARNING: column 'evidence' not
> being added due to property
> '<sqlalchemy.orm.properties.PropertyLoader object at
> 0x2aa171b6d0>'. Specify 'allow_column_override=True' to mapper() to
> ignore this condition.
>
> So I try to use the allow_column_override but it doesnt work and I
> just get a new error:
>
> raise exceptions.UnmappedColumnError("Can't execute sync rule
> for destination column '%s'; mapper '%s' does not map this column.
> Try using an explicit `foreign_keys` collection which does not
> include this column (or use a viewonly=True relation)." %
> (dest_column, source_mapper))
> sqlalchemy.exceptions.UnmappedColumnError: Can't execute sync rule
> for destination column 'ppi.evidence'; mapper 'Mapper|Paper|
> documents' does not map this column. Try using an explicit
> `foreign_keys` collection which does not include this column (or use
> a viewonly=True relation).
>
> Any help greatly appreciated,
> Many thanks in advance,
>
> Nathan
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---