diff options
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/build/changelog/migration_13.rst | 30 | ||||
| -rw-r--r-- | doc/build/changelog/unreleased_13/4500.rst | 13 |
2 files changed, 43 insertions, 0 deletions
diff --git a/doc/build/changelog/migration_13.rst b/doc/build/changelog/migration_13.rst index c133bd662..f08c59405 100644 --- a/doc/build/changelog/migration_13.rst +++ b/doc/build/changelog/migration_13.rst @@ -1662,3 +1662,33 @@ primary key column:: :ticket:`4362` :ticket:`4235` + +.. _change_4500: + +Changed StatementError formatting (newlines and %s) +================================================================================= + +Two changes are introduced to the string representation for ``StatementError``. +The "detail" and "SQL" portions of the string representation are now +separated by newlines, and newlines that are present in the original SQL +statement are maintained. The goal is to improve readability while still +keeping the original error message on one line for logging purposes. + +This means that an error message that previously looked like this:: + + sqlalchemy.exc.StatementError: (sqlalchemy.exc.InvalidRequestError) A value is required for bind parameter 'id' [SQL: 'select * from reviews\nwhere id = ?'] (Background on this error at: http://sqlalche.me/e/cd3x) + +Will now look like this:: + + sqlalchemy.exc.StatementError: (sqlalchemy.exc.InvalidRequestError) A value is required for bind parameter 'id' + [SQL: select * from reviews + where id = ?] + (Background on this error at: http://sqlalche.me/e/cd3x) + +The primary impact of this change is that consumers can no longer assume that +a complete exception message is on a single line, however the original +"error" portion that is generated from the DBAPI driver or SQLAlchemy internals +will still be on the first line. + +:ticket:`4500` + diff --git a/doc/build/changelog/unreleased_13/4500.rst b/doc/build/changelog/unreleased_13/4500.rst new file mode 100644 index 000000000..9aea02fee --- /dev/null +++ b/doc/build/changelog/unreleased_13/4500.rst @@ -0,0 +1,13 @@ +.. change:: + :tags: feature, engine + :tickets: 4500 + + Revised the formatting for :class:`.StatementError` when stringified. Each + error detail is broken up over multiple newlines instead of spaced out on a + single line. Additionally, the SQL representation now stringifies the SQL + statement rather than using ``repr()``, so that newlines are rendered as is. + Pull request courtesy Nate Clark. + + .. seealso:: + + :ref:`change_4500` |
