you should be able to use inspect(cls).polymorphic_identity

http://docs.sqlalchemy.org/en/rel_0_9/orm/mapper_config.html?highlight=polymorphic_identity#sqlalchemy.orm.mapper.Mapper.polymorphic_identity


On Jan 14, 2014, at 8:55 AM, Richard Gerd Kuesters <[email protected]> 
wrote:

> what's the best way to check and retrieve the polymorphic identity of a 
> mapped class?
> 
> I'm using:
> 
> pi = cls.__mapper_args__.get('polymorphic_identity')
> if pi:
>     # rest of the code
>     ...
> 
> I'm just wondering if there's a shortcut or a better way to achieve this, 
> since I'm not fond of using __variables__ :)
> 
> 
> best regards,
> richard.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/groups/opt_out.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to