MCPcopy Index your code
hub / github.com/sqlalchemy/sqlalchemy / test_merge_load

Method test_merge_load

test/aaa_profiling/test_orm.py:120–148  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

118 go2()
119
120 def test_merge_load(self):
121 Parent = self.classes.Parent
122
123 sess = fixture_session()
124 sess2 = fixture_session()
125 p1 = sess.get(Parent, 1)
126 p1.children
127
128 # preloading of collection took this down from 1728 to 1192
129 # using sqlite3 the C extension took it back up to approx. 1257
130 # (py2.6)
131
132 sess2.connection() # autobegin
133
134 # use a huge variance on this because it really changes quite randomly
135 # on different Python verrsions / CPUs etc.
136 @profiling.function_call_count(variance=0.50)
137 def go():
138 sess2.merge(p1)
139
140 go()
141
142 # one more time, count the SQL
143
144 def go2():
145 sess2.merge(p1)
146
147 sess2 = sessionmaker(testing.db)()
148 self.assert_sql_count(testing.db, go2, 2)
149
150
151class LoadManyToOneFromIdentityTest(fixtures.MappedTest):

Callers

nothing calls this directly

Calls 6

fixture_sessionFunction · 0.90
sessionmakerClass · 0.90
assert_sql_countMethod · 0.80
goFunction · 0.70
getMethod · 0.45
connectionMethod · 0.45

Tested by

no test coverage detected