Skip to content

Instantly share code, notes, and snippets.

@dsc
Created June 22, 2012 20:31
Show Gist options
  • Save dsc/2975014 to your computer and use it in GitHub Desktop.
Save dsc/2975014 to your computer and use it in GitHub Desktop.
modelhaiku.py
from sqlalchemy import *
class Haiku(Model):
id = Column(Integer, primary_key=True)
ctime = Column(DateTime, default=func.now())
line1 = Column(Text())
line2 = Column(Text())
line3 = Column(Text())
query = (Session.query(Haiku)
.filter(Haiku.line1.endswith('love') or
Haiku.line2.endswith('love') or
Haiku.line3.endswith('love') )
.order_by(Haiku.ctime.desc())[0:10] )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment