diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-05-27 10:18:33 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-05-27 10:21:08 -0400 |
commit | 7dc411dc63faf59b4e28fa0dea805887821d0d99 (patch) | |
tree | 35ed4c863487dfd11ed886528ad1a8306b4ba153 /lib/sqlalchemy/sql/compiler.py | |
parent | 366e88ea0e5c5417184c1dd4776cff752560631d (diff) | |
download | sqlalchemy-7dc411dc63faf59b4e28fa0dea805887821d0d99.tar.gz |
Render table hints in generic SQL
Added :meth:`.Select.with_hint` output to the generic SQL string that is
produced when calling ``str()`` on a statement. Previously, this clause
would be omitted under the assumption that it was dialect specific.
The hint text is presented within brackets to indicate the rendering
of such hints varies among backends.
Fixes: #5353
References: #4667
Change-Id: I01d97d6baa993e495519036ec7ecd5ae62856c16
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 8eae0ab7d..fc66ca517 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -3491,6 +3491,9 @@ class StrSQLCompiler(SQLCompiler): def visit_empty_set_expr(self, type_): return "SELECT 1 WHERE 1!=1" + def get_from_hint_text(self, table, text): + return "[%s]" % text + class DDLCompiler(Compiled): @util.memoized_property |