MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_exists

Method test_exists

test/orm/test_query.py:4353–4369  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4351 __dialect__ = "default"
4352
4353 def test_exists(self):
4354 User = self.classes.User
4355 sess = fixture_session()
4356
4357 q1 = sess.query(User)
4358 self.assert_compile(
4359 sess.query(q1.exists()),
4360 "SELECT EXISTS (SELECT 1 FROM users) AS anon_1",
4361 )
4362
4363 q2 = sess.query(User).filter(User.name == "fred")
4364 self.assert_compile(
4365 sess.query(q2.exists()),
4366 "SELECT EXISTS ("
4367 "SELECT 1 FROM users WHERE users.name = :name_1"
4368 ") AS anon_1",
4369 )
4370
4371 def test_exists_col_expression(self):
4372 User = self.classes.User

Callers

nothing calls this directly

Calls 5

fixture_sessionFunction · 0.90
assert_compileMethod · 0.80
queryMethod · 0.45
existsMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected