title: Enhance SQLAlchemy syntax for polymorphic identity
body: <p>I have a declarative base class <code>Entity</code> which defines the column <code>name</code> as polymorphic, e.g.</p>
  
  <pre><code>class Entity(DeclarativeBase):
      name = Column('name', String(40))
      __mapper_args__ = {'polymorphic_on':name}
  </code></pre>
  
  <p>In subclasses, I could now say</p>
  
  <pre><code>class Experiment(Entity):
      __mapper_args__ = {'polymorphic_identity': "experiment"}
  </code></pre>
  
  <p>and be done. However, I would like to ease the creation of subclasses for the users of my library and therefore make the following possible:</p>
  
  <ul>
  <li>Have a better syntax for it which is not as convoluted as the default syntax. This could be a simple assignment <code>poly_id = "exp"</code> inside the class or maybe a class decorator.</li>
  <li>If no polymorphic_identity is given, extract the name from the name of the subclass.</li>
  </ul>
  
  <p>I tried to get this done using metaclasses (only the second part):</p>
  
  <pre><code>from sqlalchemy.ext.declarative import DeclarativeMeta
  
  class Meta(type):
      def __init__(cls, classname, bases, dict_):
          dict_["__mapper_args__"] = {'polymorphic_identity': classname}
          return super(Meta, cls).__init__(classname, bases, dict_)
  
  class CombinedMeta(Meta, DeclarativeMeta):
      pass
  
  class Experiment(Entity):
      __metaclass__ = CombinedMeta
  </code></pre>
  
  <p>so that, in my opinion, my <code>Meta</code> should set the name before calling the <code>DeclarativeMeta</code> but it does not seem to work. So either the <code>DeclarativeMeta</code> which supposedly sets the polymorphic name never sees the change because I messed up the MRO or what I’m doing is plain wrong anyway. What would I need to change or is there even something like this in SQLAlchemy already?</p>