title: SQLAlchemy: CheckConstraint with string function
body: <p>Trying to use sqlalchemy.schema.CheckConstraint in this way:</p>
  
  <pre><code>themes2tags_table = Table('themes2tags', Base.metadata,
      Column('theme_id', String(32), ForeignKey('tags.id')),
      Column('tag_id', String(32), ForeignKey('tags.id')),
      PrimaryKeyConstraint(['theme_id', 'tag_id']),
      CheckConstraint("substr(theme_id,1,1)='3'"))
  </code></pre>
  
  <p>(meant many-to-many self-referential relationship over tags table and that themes are tags with predefined prefix, obviously), what ends up with</p>
  
  <pre><code>    ...CheckConstraint("substr(theme_id,1,1)='3'")
    File "build\bdist.win32\egg\sqlalchemy\schema.py", line 303, in __new__
    File "build\bdist.win32\egg\sqlalchemy\schema.py", line 370, in _init
    File "build\bdist.win32\egg\sqlalchemy\schema.py", line 64, in _init_items
    File "build\bdist.win32\egg\sqlalchemy\events.py", line 234, in _set_parent_wi
  th_dispatch
    File "build\bdist.win32\egg\sqlalchemy\schema.py", line 2133, in _set_parent
    File "build\bdist.win32\egg\sqlalchemy\schema.py", line 1909, in _set_parent
    File "build\bdist.win32\egg\sqlalchemy\schema.py", line 1883, in _set_parent
    File "build\bdist.win32\egg\sqlalchemy\sql\expression.py", line 2213, in add
  AttributeError: 'list' object has no attribute 'key'
  </code></pre>
  
  <p>Where am I wrong here? Is it possible to have such a constraint in these circumstances?</p>
  
  <p>Current backend is sqlite, but I consider migrating to Postgres in the future, so looking for a more-less generic receipt.</p>
  
  <p>Upd: sqlalchemy 0.7.5</p>