title: Define a count by foreign key relationship on a model using SQLAlchemy
body: <p>I have <code>ModelA</code> and <code>ModelB</code> classes, and I want to define an attribute on <code>ModelA</code> called <code>number_of_b_models</code> whose value is the result of the next query:</p>
  
  <p><code>SELECT count(modelb.id) FROM modelb WHERE modelb.a_id = :1 AND modelb.status = 2</code> </p>
  
  <p>where <code>:1</code> is replaced by <code>a.id</code> from <code>ModelA</code>. </p>
  
  <p>Since the query itself is so straightforward and self-explanatory it doesn't have to use the <code>func.count</code> construct, or any other SQLAlchemy construct - just to allow me to comfortably use <code>number_of_b_models</code> from an instance of <code>ModelA</code>.</p>
  
  <p>How do i define <code>number_of_b_models</code> on <code>ModelA</code>?</p>