title: How to get query a certain period of datetime in Flask sqlalchemy?
body: <p>In Flask, I have a model named User, like this:</p>
  
  <pre><code>class Post(db.Model):
      __tablename__ = 'post'
      id = db.Column(db.Integer, primary_key=True)
      title = db.Column(db.String(255))
      content = db.Column(db.Text)
      post_time = db.Column(db.DateTime(), index=True, default=datetime.now)
  </code></pre>
  
  <p>I wanna query a certain period datetime, for example, I need to query all the posts posted between <code>2016-11-01</code> and <code>2016-11-30</code>
  <br >
  I tried to achieve this by Stitching string, like this:</p>
  
  <pre><code>posts = Post.query.filter(Post.post_time &lt;= year_month+'-30').filter(Post.post_time &gt;= year_month+'-01')
  </code></pre>
  
  <p>but this is awkward, is there any better way to to that?</p>