diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-09-18 11:44:48 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-09-18 11:44:48 -0400 |
| commit | f82f6d55dc05daf2ba0881ded98f5715b70ae3e3 (patch) | |
| tree | 0686f4a11aa825fdc1994c566da78382e7dcf071 /test/orm/test_query.py | |
| parent | e3f07f7206cf0d6a5f2ff9344a365f4657645338 (diff) | |
| download | sqlalchemy-f82f6d55dc05daf2ba0881ded98f5715b70ae3e3.tar.gz | |
- Added new method :meth:`.Select.with_statement_hint` and ORM
method :meth:`.Query.with_statement_hint` to support statement-level
hints that are not specific to a table.
fixes #3206
Diffstat (limited to 'test/orm/test_query.py')
| -rw-r--r-- | test/orm/test_query.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/orm/test_query.py b/test/orm/test_query.py index c9f0a5db0..52e266a08 100644 --- a/test/orm/test_query.py +++ b/test/orm/test_query.py @@ -2517,6 +2517,28 @@ class HintsTest(QueryTest, AssertsCompiledSQL): "ON users_1.id > users.id", dialect=dialect ) + def test_statement_hints(self): + User = self.classes.User + + sess = create_session() + stmt = sess.query(User).\ + with_statement_hint("test hint one").\ + with_statement_hint("test hint two").\ + with_statement_hint("test hint three", "postgresql") + + self.assert_compile( + stmt, + "SELECT users.id AS users_id, users.name AS users_name " + "FROM users test hint one test hint two", + ) + + self.assert_compile( + stmt, + "SELECT users.id AS users_id, users.name AS users_name " + "FROM users test hint one test hint two test hint three", + dialect='postgresql' + ) + class TextTest(QueryTest, AssertsCompiledSQL): __dialect__ = 'default' |
