title: SQLAlchemy filter, substr, case
body: <p>Can I use a <code>CASE</code> statement within <code>substr</code> and <code>filter</code>?</p>
  
  <p>Here is my requirement:</p>
  
  <pre><code>&gt;&gt; value = '00021050430' #here value is a database column
  &gt;&gt; query.filter((func.substr(value,case([(func.length(value) &gt; 7,func.length(varying_value)-7+1))],else_=1),7)=='1050430')
  </code></pre>
  
  <p>Output I am expecting is:</p>
  
  <pre><code>&gt;&gt; query.filter(func.substr(value,6,7))
  </code></pre>
  
  <p>The above throws an error.</p>