Meanwhile... meh.  I'll be more than happy to go with Numeric(16,2) as
suggested by #postgresql.  Should work fine and the only disadvantage
is the most minor of semantic objections.


On Dec 18, 1:57 pm, Eric Ongerth <ericonge...@gmail.com> wrote:
> Hmm, I read through all of the relevant files, postgresql.py and the
> rest, and of course this section of the SA 
> docs:http://www.sqlalchemy.org/docs/core/types.html#custom-types
>
> But I'm confused about a couple of things.  One: what I'm reading
> seems to be suggesting that I just ignore the existence of a postgres
> Money type and just TypeDecorate a Numeric to get what I want.  I was
> hoping to do the necessary plumbing to get SA to recognize columns in
> reflected tables that are defined as Money type and work with them
> appropriately.  Am I missing something?
>
> Two, and closely related, If I just make a TypeDecorator, or even my
> own UserDefinedType, I'm not yet seeing how SA will know to make use
> of it when reflecting.
>
> I guess what I'm really asking is this: If SA doesn't 'know about'
> postgresql's Money type, it doesn't know about it!  I understand how
> to fake it by making a type decorator so I can store what I need to in
> a Numeric column but have it represented in my python objects via any
> interface I please.  What I don't understand is how to make SA
> actually USE the native postgresql Money type.
>
> It's probably right in front of my face but maybe I'm misinterpreting
> some of the code so I keep falling back into the same mental orbit
> about it.
>
> Thanks in advance if you can help clear my view.
>
> On Dec 18, 1:15 pm, Eric Ongerth <ericonge...@gmail.com> wrote:
>
> > Postgres deprecated the Money data type around 8.2 but then brought it
> > back with better support soon after (I think 8.3 or 8.4 and after).
>
> > I found the following message on this group, where Mike welcomes
> > anyone to just roll their own type stuff for it or possibly submit a
> > patch.
>
> >http://groups.google.com/group/sqlalchemy/msg/77efa08097492b1a
>
> > This should be easy enough to do; I'm just wondering if anyone has
> > already done so and is willing to share, just to avoid reinventing a
> > wheel.
>
> > Thanks!

-- 
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