Skip to content

Instantly share code, notes, and snippets.

@tell-k
Created September 13, 2012 14:13
Show Gist options
  • Save tell-k/3714582 to your computer and use it in GitHub Desktop.
Save tell-k/3714582 to your computer and use it in GitHub Desktop.
db_session = scoped_session(sessionmaker(bind=engine))
db_session.add(Entry(id=1, text="entrytext"))
# select entry ------
entry1 = Entry.query.filter_by(id=1).first()
print entry1.text # => "entrytext"
db_session.add(Entry(id=2, text="entrytext"))
db_session.flush()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment