Question
Here is model:
- class User(Base):
- ...
- birthday = Column(Date, index=True) #in database it's like '1987-01-17'
- ...
I think of:
- query = DBSession.query(User).filter(
- and_(User.birthday >= '1988-01-17', User.birthday <= '1985-01-17')
- )
- # means age >= 24 and age <= 27
How-To
In fact, your query is right except for the typo: your filter is excluding all records: you should change the <= for >= and vice versa:
- qry = DBSession.query(User).filter(
- and_(User.birthday <= '1988-01-17', User.birthday >= '1985-01-17'))
- # or same:
- qry = DBSession.query(User).filter(User.birthday <= '1988-01-17').\
- filter(User.birthday >= '1985-01-17')
- qry = DBSession.query(User).filter(User.birthday.between('1985-01-17', '1988-01-17'))
Use this diet hack to drop 2 lb of fat in just 8 hours
回覆刪除Well over 160 thousand men and women are using a easy and secret "liquids hack" to drop 2lbs each night while they sleep.
It's scientific and works all the time.
This is how to do it yourself:
1) Get a glass and fill it with water half glass
2) Then learn this strange hack
and you'll be 2lbs skinnier the very next day!