summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/exc.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-08-22 11:12:36 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-08-22 11:12:36 -0400
commitd3c1f245efb22b45c77561345346469cf6a82ddd (patch)
treed0a403d74c779e8a9f130f5a6b83ad67bd589189 /lib/sqlalchemy/exc.py
parent647a28a03e21c70c2195c2a0ea6f6c3e21d72958 (diff)
downloadsqlalchemy-d3c1f245efb22b45c77561345346469cf6a82ddd.tar.gz
- Improvement to multi-param statement logging,
long lists of bound parameter sets will be compressed with an informative indicator of the compression taking place. Exception messages use the same improved formatting. [ticket:2243]
Diffstat (limited to 'lib/sqlalchemy/exc.py')
-rw-r--r--lib/sqlalchemy/exc.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/sqlalchemy/exc.py b/lib/sqlalchemy/exc.py
index 951e44d61..0cc52fd25 100644
--- a/lib/sqlalchemy/exc.py
+++ b/lib/sqlalchemy/exc.py
@@ -146,15 +146,11 @@ class StatementError(SQLAlchemyError):
self.orig = orig
def __str__(self):
- if isinstance(self.params, (list, tuple)) and \
- len(self.params) > 10 and \
- isinstance(self.params[0], (list, dict, tuple)):
- return ' '.join((SQLAlchemyError.__str__(self),
- repr(self.statement),
- repr(self.params[:2]),
- '... and a total of %i bound parameter sets' % len(self.params)))
+ from sqlalchemy.sql import util
+ params_repr = util._repr_params(self.params, 10)
return ' '.join((SQLAlchemyError.__str__(self),
- repr(self.statement), repr(self.params)))
+ repr(self.statement), repr(params_repr)))
+
class DBAPIError(StatementError):
"""Raised when the execution of a database operation fails.