title: SQLAlchemy - filtering rows before today with autoloaded DATETIME column?
body: <p>I have a MARIADB database <code>radio_progs</code> with a table <code>FUTUREEPISODE</code>. I'm using SQLAlchemy and trying to add a function that selects <strong>all entries in the table that are before today</strong>.</p>
  <p>I'm having problems with the datetime field though. Is this as I'm autoloading the fields? In my real world example I have a number of columns so would prefer to autoload than specify each individually.</p>
  <p>error is</p>
  <pre class="lang-sh prettyprint-override"><code>    eps = self.query.filter_by(IN_LIST=1, EP_ENDTIME &lt; todays_datetime).all()
                                                                                         ^
  SyntaxError: positional argument follows keyword argument
  </code></pre>
  <p>The table has the following columns</p>
  <pre><code>
  | Column     | Type       |
  | ---------- | ---------- |
  | ID         | int(11)    |
  | EP_ENDTIME | datetime   |
  | IN_LIST    | tinyint(1) |
  
  
  </code></pre>
  <pre class="lang-py prettyprint-override"><code>from datetime import datetime
  from sqlalchemy import and_, func
  
  from .dbmgr import db
  
  class FutureEpisode(db.Model):
      __bind_key__ = 'radio_progs'
      __tablename__ = 'FUTUREEPISODE'
  
      __table_args__ = {
          'autoload': True,
          'autoload_with': db.engine
      }
  
      def get_expired(self):
  
          todays_datetime = datetime(datetime.today().year, datetime.today().month, datetime.today().day)
          eps = self.query.filter_by(IN_LIST=1, EP_ENDTIME &lt; todays_datetime).all()
          return eps
  </code></pre>