Converter for decimal.Decimal (again)
"Antonio Valente" <[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
Hi, all!
Some months ago (in september 2006) I asked how to deal with python
decimal.Decimal values. While adapting them is trivial (an adapter
function must only call str(value)), converting the return values from
sqlite is a big problem for me.
If I declare a column like:
DECIMAL(9,2)
or such, and I register a converter function like:
register_converter("DECIMAL", a_converter_function)
it won't work. The call should be something like:
register_converter("DECIMAL(9,2)", a_converter_function)
That's not very useful, because I cannot register a converter for each
variant of length and precision I use. The solution was to use a row
factory.
Now, I feel the problem again, since I use sqlalchemy and I cannot
figure out how to use a row factory with it.
Anybody can help me?
Thanks a lot