title: Sqlalchemy check constraint on count of column
body: <p>I have this table in sqlalchemy:</p>
  
  <pre><code>class Table(Model):
    __table_name__ = 'tbl'
    col1 = Column(Integer)
    col2 = Column(Integer)
  </code></pre>
  
  <p>I want to add this constraint to my model:</p>
  
  <pre><code>check ( count ( select * 
                  from tbl t1, tbl t2
                  where t1.clo2=t2.col2) &lt; 3)
  </code></pre>
  
  <p>I put this query in <code>CheckConstraint</code> but not works.</p>