summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/selectable.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-05-08 11:40:12 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-05-08 11:42:36 -0400
commitc608c3f2f8af0e4cd9e2ffbd3b6f7f487e785282 (patch)
tree2b89b29c1ed6bbf2b6910fc9a672552a375eb78f /lib/sqlalchemy/sql/selectable.py
parent8b91bf419e9d10ce64a096cdeda1939f25f77ed7 (diff)
downloadsqlalchemy-c608c3f2f8af0e4cd9e2ffbd3b6f7f487e785282.tar.gz
Add documentation for MySQL optimizer hints using prefix_with
Fixes: #4667 Change-Id: Iac3345319dc7c5a20bc7a6520492d2f341b64807
Diffstat (limited to 'lib/sqlalchemy/sql/selectable.py')
-rw-r--r--lib/sqlalchemy/sql/selectable.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py
index a44e94da7..ff9ab984e 100644
--- a/lib/sqlalchemy/sql/selectable.py
+++ b/lib/sqlalchemy/sql/selectable.py
@@ -165,6 +165,9 @@ class HasPrefixes(object):
stmt = table.insert().prefix_with("LOW_PRIORITY", dialect="mysql")
+ # MySQL 5.7 optimizer hints
+ stmt = select([table]).prefix_with("/*+ BKA(t1) */", dialect="mysql")
+
Multiple prefixes can be specified by multiple calls
to :meth:`.prefix_with`.
@@ -3152,6 +3155,10 @@ class Select(HasPrefixes, HasSuffixes, GenerativeSelect):
:meth:`.Select.with_hint`
+ :meth:.`.Select.prefix_with` - generic SELECT prefixing which also
+ can suit some database-specific HINT syntaxes such as MySQL
+ optimizer hints
+
"""
return self.with_hint(None, text, dialect_name)