diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-06-09 01:24:08 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-06-09 01:24:08 +0000 |
| commit | 3cd10102e44db28d5fb787c7492e2ac2f7a4e4f9 (patch) | |
| tree | 5a9c9893bc9b13f07a97dd18de7287854de07fc5 /examples | |
| parent | cde133c45d01848cd5696113fe94f269b7fe8d9c (diff) | |
| download | sqlalchemy-3cd10102e44db28d5fb787c7492e2ac2f7a4e4f9.tar.gz | |
- Query.UpdateDeleteTest.test_delete_fallback fails on mysql due to subquery in DELETE; not sure how to do this exact operation in MySQL
- added query_cls keyword argument to sessionmaker(); allows user-defined Query subclasses to be generated by query().
- added @attributes.on_reconstitute decorator, MapperExtension.on_reconstitute, both receieve 'on_load' attribute event allowing
non-__init__ dependent instance initialization routines.
- push memusage to the top to avoid pointless heisenbugs
- renamed '_foostate'/'_fooclass_manager' to '_sa_instance_state'/'_sa_class_manager'
- removed legacy instance ORM state accessors
- query._get() will use _remove_newly_deleted instead of expunge() on ObjectDeleted, so that transaction rollback
restores the previous state
- removed MapperExtension.get(); replaced by a user-defined Query subclass
- removed needless **kwargs from query.get()
- removed Session.get(cls, id); this is redundant against Session.query(cls).get(id)
- removed Query.load() and Session.load(); the use case for this method has never been clear, and the same functionality is available in more explicit ways
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/query_caching/query_caching.py | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/examples/query_caching/query_caching.py b/examples/query_caching/query_caching.py index fb250acca..70dc6683c 100644 --- a/examples/query_caching/query_caching.py +++ b/examples/query_caching/query_caching.py @@ -30,21 +30,13 @@ class CachingQuery(Query): else: return Query.__iter__(self) -# currently the easiest way to get a custom Query class in the mix is just -# to subclass Session. A decorated sessionmaker() would probably work too. -class CacheableSession(Session): - def __init__(self, **kwargs): - super(CacheableSession, self).__init__(**kwargs) - self._query_cls = CachingQuery - - # example usage if __name__ == '__main__': from sqlalchemy import Column, create_engine, Integer, String from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base - Session = sessionmaker(class_=CacheableSession) + Session = sessionmaker(query_cls=CachingQuery) Base = declarative_base(engine=create_engine('sqlite://', echo=True)) |
