title: How to filter by date with sqlalchemy
body: <p>After I import the modules:</p>
  
  <pre><code>import datetime, uuid
  from sqlalchemy.ext.declarative import declarative_base
  from sqlalchemy.orm import scoped_session, sessionmaker
  from sqlalchemy import Column, ForeignKey, Integer, String, DateTime, create_engine, literal
  </code></pre>
  
  <p>I proceed by connecting to db:</p>
  
  <pre><code>Base = declarative_base()
  session = scoped_session(sessionmaker())
  engine = create_engine('mysql://root:pass@localhost/testdb', echo=False)
  session.remove()
  session.configure(bind=engine, autoflush=False, expire_on_commit=False)
  </code></pre>
  
  <p>I define and create MyObject's table:</p>
  
  <pre><code>class MyObject(Base):
      __tablename__ = 'myobjects'
      uuid = Column(String(64), primary_key=True, unique=True)
      created = Column(DateTime, nullable=False) 
  
      def __init__ (self, *args, **kwargs):
          self.uuid = str(uuid.uuid4()).replace('-','').lower()
          self.created = datetime.datetime.utcnow()
  
  Base.metadata.create_all(engine)
  </code></pre>
  
  <p>I create 10 <code>MyObject</code> entities:</p>
  
  <pre><code>for i in range(10):
      obj = MyObject()
      session.add(obj)
      session.commit()
  </code></pre>
  
  <p>I query all the entities by printing their date created:</p>
  
  <pre><code>objects = session.query(MyObject).all()
  for obj in objects:
      print obj.created
  </code></pre>
  
  <p>prints:</p>
  
  <pre><code>2017-01-05 17:22:21
  2017-01-05 17:22:21
  .
  .
  .
  2017-01-05 17:22:43
  </code></pre>
  
  <p><strong>Question:</strong></p>
  
  <p>How to query by filtering only those entities that were not created on exactly '2017-01-05 17:22:43'?</p>
  
  <p>I have tried this:</p>
  
  <pre><code>result = session.query(MyObject).filter(MyObject.created!='2017-01-05 17:22:43').all()
  </code></pre>
  
  <p>But it returns all the objects filtering nothing...</p>