Chris Withers wrote:
> Hi All,
>
> We're using single table inheritence in one of our projects but we have
> some obsolete rows that are each mapped to their own python class.
>
> If we remove the obsolete classes, when we try and do:
>
> session.query(TheBaseClass)
>
> ...we get:
>
>    File
> "/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.5-py2.5.egg/sqlalchemy/orm/mapper.py",
> line 1742, in configure_subclass_mapper
>      raise AssertionError("No such polymorphic_identity %r is defined" %
> discriminator)
> AssertionError: No such polymorphic_identity 'TheClassName' is defined
>
> Is there any way to phrase that query as "just ignore rows where no
> polymorphic mapper can be found"?
>
> If not, I guess I need to do session.query(TheClassName).delete() before
> I remove the code, right?

it would be best to remove the rows.  Otherwise, you'd need to filter()
your queries on "TheBaseClass.type != 'TheClassName'" to prevent those
rows from coming in.

This is a common problem we have all the time here.

--

You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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