Hi, I'm just learning to use sqlalchemy now (although I've had some
exposure to SQLObject and Django ORM, so not completely new to the
game).

I'd like to address a standard ORM issue - i.e. interfacing Python
Decimal objects with SQLite backend.  It seems that sqlalchemy follows
the standard strategy of passing the buck to sqlite, which converts
fixed-point to floating point.

If I may be pardoned a diversion... I understand why sqlite does this,
but it constantly boggles my mind that ORM layers allow fixed<-
>floating conversions.  I have yet to find a single application where
this is desirable behavior, since fixed-point generally goes along
with guarantees of strict equality (I'm speaking here as a finance
geek, money-handling being perhaps the preeminent real-world use of
Decimals).

Anyway, religious matters notwithstanding... although I'm comforted by
sqlite's assurance that it tests identity out to 15 decimal places,
which exceeds my own needs for precision... I would like to follow the
recommendation of sqlalchemy, and guarantee strict precision by use of
Decimal<->String<->Decimal conversions round-tripping to the
database.  I am looking at the sqlalchemy.types source code, and I
like what I see... it looks not difficult to define what I want with
AbstractType, UserDefinedType, TypeDecorator, etc.

However, as a new user, the docstrings aren't completely clear.  Can
y'all give a hint to a newbie looking not to reinvent the wheel?  Can
I use TypeDecorator with impl=types.Numeric?  If so, what do I need to
override - bind_processor(), result_processor(), and/or what?

I can't be the first person to want to do this.  TIA for any pointers.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to