On 4/22/15 3:48 AM, Pavel S wrote:
Hi,

it happened to me many times during development, mainly when used custom column types, that I passed wrong type of value to the query.

Then the the following warning was emitted:|

||
SAWarning: Unicodetype received non-unicode bindparam value
|
The problem with such warning is it does not say
1) were the problem occurred (the line number points to somewhere in sqlalchemy and not to my application)
Use the warnings filter to turn these into exceptions:

import warnings
warnings.simplefilter("error")


2) what was the value which caused the problem ( repr() of that value would be nice to have)
This was not possible for a long time because when you emit a warning of a specific message, the Python interpreter stores it *permanently* in a hidden collection - this is how Python knows not to emit the warning a second time. Which means if our warning emitted the actual string, and the program proceeded through millions of values, you would get millions of warnings, these warnings would be all stored permanently, and your application would crash from out of memory fairly quickly (if not just the burden of outputting millions of warnings).

In 1.0 we have come up with a novel approach such that we display just the first 10 warnings of this nature, illustrating the string value.

I'd say upgrade to 1.0 however don't go into production with it until I get 1.0.1 out, as we had a bunch of regressions not located during the beta period.


--
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to