jose soares wrote:
> Hi all,
>
> I'm using Oracle and PostgreSQL with SQLAlchemy and I have some troubles
> to make the code compatible  with both of them.
> Numeric sa type returns a different type with oracle and pg.
>
> For example, in the following table I'm using the Column 'importo' with
> type Numeric as:
>
>
> tbl['prestazione'] = Table('prestazione', database.metadata,
>         Column('id', Integer, Sequence('prestazione_seq'),
> nullable=False, primary_key=True),
>         Column('data', Date, nullable=False),
>         Column('quantita', Numeric(15,3)),
>         Column('importo', Numeric(12,3))
> )
>
> while oracle returns a float type as:
>
> prestazione.c.importo = 12.0
>
>
> postgres returns a Decimal type as:
>
> prestazione.c.importo = Decimal("0.000")
>
> and I have difficulties to make code compatible, because sometimes the
> program raises a TypeError error as:
>
>     TypeError: unsupported operand type(s) for +: 'Decimal' and 'float'
>
> Is there some w.a. to avoid this thing?

if you're on 0.6 (or even 0.5 for that matter) the Numeric type should be
returning Decimal in all cases from result sets.





>
> thank you,
>
> j
>
>
>
>
>
> --
> 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.
>
>

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