diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-03-09 13:07:09 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-03-09 13:07:09 -0400 |
| commit | fcfa62bd76ee0cdb125f0eb46ec4c1f625cbd6e7 (patch) | |
| tree | 472316b51c093bdf8bc84140975794a86c3e28c6 /test/aaa_profiling | |
| parent | fdd2b42db59c9a37c609217f3bbee99e53b3403e (diff) | |
| download | sqlalchemy-fcfa62bd76ee0cdb125f0eb46ec4c1f625cbd6e7.tar.gz | |
- start locking down querying for cols after observing yesterdays
callcount bump due to the slots thing
- rewrite profiles using new technique
Diffstat (limited to 'test/aaa_profiling')
| -rw-r--r-- | test/aaa_profiling/test_orm.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/test/aaa_profiling/test_orm.py b/test/aaa_profiling/test_orm.py index 9251e75e1..71e7b32f4 100644 --- a/test/aaa_profiling/test_orm.py +++ b/test/aaa_profiling/test_orm.py @@ -461,3 +461,55 @@ class SessionTest(fixtures.MappedTest): def go(): sess.expire_all() go() + +class QueryTest(fixtures.MappedTest): + @classmethod + def define_tables(cls, metadata): + Table( + 'parent', + metadata, + Column('id', Integer, + primary_key=True, test_needs_autoincrement=True), + Column('data1', String(20)), + Column('data2', String(20)), + Column('data3', String(20)), + Column('data4', String(20)), + ) + + @classmethod + def setup_classes(cls): + class Parent(cls.Basic): + pass + + @classmethod + def setup_mappers(cls): + Parent = cls.classes.Parent + parent = cls.tables.parent + + mapper(Parent, parent) + + def _fixture(self): + Parent = self.classes.Parent + sess = Session() + sess.add_all([ + Parent(data1='d1', data2='d2', data3='d3', data4='d4') + for i in range(10) + ]) + sess.commit() + sess.close() + + def test_query_cols(self): + Parent = self.classes.Parent + self._fixture() + sess = Session() + + @profiling.function_call_count() + def go(): + for i in range(10): + q = sess.query( + Parent.data1, Parent.data2, Parent.data3, Parent.data4 + ) + + q.all() + + go() |
