Hi:
Sorry for describe so clear, the 0.0 must be a money type but the
value is 0.0, is that pygresql doesn't support money type?
Here is my code
==cut==
class stock_anly:
def __init__(self):
self.dbName = 'redhill'
self.ServerName = 'xxx_lnx'
self.User = 'xx'
self.db =
pg.DB(dbname=self.dbName,host=self.ServerName,user=self.User)
def getStockShift(self):
db = self.db
sqlcmd = 'select * from xx_table'
dicShift = db.query(sqlcmd).getresult()
print dicShift
==cut==
Here is the result:
==cut==
[('600997', '2009-03-13', 0.0, 0.0, 0.0, 0.0, 0.0, 7445824, 0.0),
('600997', '2009-03-16', 0.0, 0.0, 0.0, 0.0, 0.0, 5739441, 0.0),
('600997', '2009-03-17', 0.0, 0.0, 0.0, 0.0, 0.0, 13226459, 0.0),
('600997', '2009-03-18', 0.0, 0.0, 0.0, 0.0, 0.0, 23035323, 0.0),
('600997', '2009-03-19', 0.0, 0.0, 0.0, 0.0, 0.0, 26292947, 0.0),
('600997', '2009-03-20', 0.0, 0.0, 0.0, 0.0, 0.0, 26866619, 0.0),
('600997', '2009-03-23', 0.0, 0.0, 0.0, 0.0, 0.0, 24262196, 0.0),
('600997', '2009-03-24', 0.0, 0.0, 0.0, 0.0, 0.0, 35013359, 0.0),
('600997', '2009-03-25', 0.0, 0.0, 0.0, 0.0, 0.0, 31971794, 0.0)]
==cut==
2009/3/24 D'Arcy J.M. Cain <[email protected]>:
> On Tue, 24 Mar 2009 23:37:04 +0800
> OnMyWay <[email protected]> wrote:
>> I get 0.0 value of money type from postgresql database when i am
>> using DB.query('sql').getresult(). I research on google but most of
>> the change log said it fixed after 3.5.1. Could any one know about
>> this issue?
>
> Can you clarify the problem? Is there a short SQL CREATE TABLE
> definition and Python script that you can supply that shows the actual
> error that you see? Here, for example, is what you seem to be trying
> to describe above. Note parens after DB and assumption of default
> database being available.
>
> import pg
> print pg.DB().query('sql').getresult()
>
> And the result:
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/pkg/lib/python2.5/site-packages/pg.py", line 313, in query
> return self.db.query(qstr)
> pg.ProgrammingError: ERROR: syntax error at or near "sql"
> LINE 1: sql
> ^
>
> If I change the second line to this:
>
> print pg.DB().query("select '0.0'::money").getresult()
>
> I get this:
>
> [(Decimal("0.00"),)]
>
> If this doesn't help then please explain your problem in more detail.
>
> --
> D'Arcy J.M. Cain
> PyGreSQL Development Group
> http://www.PyGreSQL.org
>
--
提供定制Clearcase脚本服务。
_______________________________________________
PyGreSQL mailing list
[email protected]
http://mailman.vex.net/mailman/listinfo/pygresql