On 02/11/2016 01:46 PM, immerrr again wrote:
Hi everyone

Say, I'm writing an API and I want to add a JsonDict TypeDecorator,
just like in the example provided in the documentation [1]. MySQL
database has a restriction on the size of BLOB columns and would
complain if I try to write a bigger value to it. I want to validate
the user input before sending it to the DB, so that the user of the
API can learn which field exceeded the length limitation and fix it.

Is there a way to report the name of the parameter in the exception
thrown from process_bind_parameter?

1. 
http://docs.sqlalchemy.org/en/latest/core/custom_types.html#marshal-json-strings

not currently, no. For the exception raised from within bind_processor to have this information directly an across-the-board change to the TypeEngine API would need to be made, which would break all third party dialects, unless we add in a new method, deprecate the old one, and generally go crazy with it.

A better option is to enhance the callpoint at which the bind processor is invoked to augment an exception with contextual information about the key.









--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to