MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_statement_hints

Method test_statement_hints

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

Source from the content-addressed store, hash-verified

5849 )
5850
5851 def test_statement_hints(self):
5852 User = self.classes.User
5853
5854 sess = fixture_session()
5855 stmt = (
5856 sess.query(User)
5857 .with_statement_hint("test hint one")
5858 .with_statement_hint("test hint two")
5859 .with_statement_hint("test hint three", "postgresql")
5860 )
5861
5862 self.assert_compile(
5863 stmt,
5864 "SELECT users.id AS users_id, users.name AS users_name "
5865 "FROM users test hint one test hint two",
5866 )
5867
5868 self.assert_compile(
5869 stmt,
5870 "SELECT users.id AS users_id, users.name AS users_name "
5871 "FROM users test hint one test hint two test hint three",
5872 dialect="postgresql",
5873 )
5874
5875
5876class ParentTest(QueryTest, AssertsCompiledSQL):

Callers

nothing calls this directly

Calls 4

fixture_sessionFunction · 0.90
with_statement_hintMethod · 0.80
assert_compileMethod · 0.80
queryMethod · 0.45

Tested by

no test coverage detected