diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-11-14 08:54:56 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-11-14 10:28:40 -0500 |
commit | eea0f44bbdb759368996dcdb241e837c7c809fb9 (patch) | |
tree | 12ecc66f8183896b833a08c90ebf39799610d816 /lib/sqlalchemy/sql/util.py | |
parent | 9f4ac8d155f58b59cf314cfbc73195ed51a0c146 (diff) | |
download | sqlalchemy-eea0f44bbdb759368996dcdb241e837c7c809fb9.tar.gz |
add informative exception context for literal render
An informative re-raise is now thrown in the case where any "literal
bindparam" render operation fails, indicating the value itself and
the datatype in use, to assist in debugging when literal params
are being rendered in a statement.
Fixes: #8800
Change-Id: Id658f8b03359312353ddbb0c7563026239579f7b
Diffstat (limited to 'lib/sqlalchemy/sql/util.py')
-rw-r--r-- | lib/sqlalchemy/sql/util.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py index 55c6a35f8..1f9944529 100644 --- a/lib/sqlalchemy/sql/util.py +++ b/lib/sqlalchemy/sql/util.py @@ -581,6 +581,12 @@ class _repr_base: return rep +def _repr_single_value(value): + rp = _repr_base() + rp.max_chars = 300 + return rp.trunc(value) + + class _repr_row(_repr_base): """Provide a string view of a row.""" |