sqlalchemy.inspect.__dict__

Here are the examples of the python api sqlalchemy.inspect.__dict__ taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

0 Source : test_baked.py
with Apache License 2.0
from gethue

    def test_get_includes_getclause(self):
        # test issue #3597
        User = self.classes.User

        bq = self.bakery(lambda s: s.query(User))

        for i in range(5):
            sess = Session()
            u1 = bq(sess).get(7)
            eq_(u1.name, "jack")
            sess.close()

        eq_(len(bq._bakery), 2)

        # simulate race where mapper._get_clause
        # may be generated more than once
        from sqlalchemy import inspect

        del inspect(User).__dict__["_get_clause"]

        for i in range(5):
            sess = Session()
            u1 = bq(sess).get(7)
            eq_(u1.name, "jack")
            sess.close()
        eq_(len(bq._bakery), 4)


class ResultPostCriteriaTest(BakedTest):

0 Source : test_baked.py
with MIT License
from sqlalchemy

    def test_get_includes_getclause(self):
        # test issue #3597
        User = self.classes.User

        bq = self.bakery(lambda s: s.query(User))

        for i in range(5):
            sess = fixture_session()
            u1 = bq(sess).get(7)
            eq_(u1.name, "jack")
            sess.close()

        eq_(len(bq._bakery), 2)

        # simulate race where mapper._get_clause
        # may be generated more than once
        from sqlalchemy import inspect

        del inspect(User).__dict__["_get_clause"]

        for i in range(5):
            sess = fixture_session()
            u1 = bq(sess).get(7)
            eq_(u1.name, "jack")
            sess.close()

        # this went from 4 to 3 as a result of #6055.  by giving a name
        # to the bind param in mapper._get_clause, while the baked cache
        # here grows by one element, the SQL compiled_cache no longer
        # changes because the keys of the bindparam() objects are passed
        # explicitly as params to the execute() call as a result of
        #  _load_on_pk_identity() (either the one in baked or the one in
        # loading.py), which then puts them
        # in column_keys which makes them part of the cache key.  These
        # were previously anon names, now they are explicit so they
        # stay across resets
        eq_(len(bq._bakery), 3)


class ResultPostCriteriaTest(BakedTest):