title: SQLAlchemy - adding OR condition with different filter
body: <p>For the SQL statement, I want to do an OR filter only if the input variable is not None.</p>
  
  <p>E.g</p>
  
  <pre><code># input variable
  var_1 = "apple"
  var_2 = "pear"
  
  query = session.query(Table)
  if var_1:
      query = query.filter(or_(Table.field1 == var_1))
  if var_2:
      query = query.filter(or_(Table.field2 == var_2))
  </code></pre>
  
  <p>But this is not possible.  The 2nd query became an AND statement instead. </p>
  
  <p>I don't want to do this because I don't want to compare an input variable if it's null or empty string.</p>
  
  <pre><code>query = query.filter(or_(Table.field1 == var_1, Table.field2 == var_2))
  </code></pre>
  
  <p>How do I solve this?</p>