Created
November 5, 2009 10:02
-
-
Save inklesspen/226938 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def session_mapper(scoped_session): | |
| def mapper(cls, *arg, **kw): | |
| cls.query = scoped_session.query_property() | |
| return sqla_mapper(cls, *arg, **kw) | |
| return mapper | |
| mapper = session_mapper(Session) | |
| # Then, you can do like Book.query.get(id) or User.query.filter_by(username="bar") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment