[sqlalchemy] SqlAlchemy+cx_oracle decimal point problem with stddev

2011-02-22 Thread Massi
Hi everyone, in my script (python 2.6, Oracle10g, cx_oracle 5.0.4,
sqlalchemy 0.6.5) I'm running the following simple query on one of my
tables:

table = Table(my_data_table, metadata, autoload=True)
col = getattr(table.c, my_integer_col)
res = select(func.stdev(col)).execute().fetchone()

where my_integer_col obviously contains only int values.
I get the following error:
...
  File C:\Python26\lib\site-packages\sqlalchemy\engine\base.py, line
2445, in _fetchone_impl
return self.cursor.fetchone()
  File C:\Python26\lib\site-packages\sqlalchemy\dialects\oracle
\cx_oracle.py, line 496, in maybe_decimal
return int(value)
ValueError: invalid literal for int() with base 10:
'18,89258326656747167219869520430353668307'

I think this is related with the usage of the comma decimal point in
the results, but the error is raised by the cx_oracle module so I
cannot handle it. is this a bug or am I missing something?
Thanks in advance!

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@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.



Re: [sqlalchemy] SqlAlchemy+cx_oracle decimal point problem with stddev

2011-02-22 Thread Michael Bayer

Regarding the comma, set NLS_LANG to a locale that uses a decimal point, or use 
0.6.6, this behavior is described in the third paragraph at 
http://www.sqlalchemy.org/docs/dialects/oracle.html#precision-numerics .





On Feb 22, 2011, at 8:54 AM, Massi wrote:

 Hi everyone, in my script (python 2.6, Oracle10g, cx_oracle 5.0.4,
 sqlalchemy 0.6.5) I'm running the following simple query on one of my
 tables:
 
 table = Table(my_data_table, metadata, autoload=True)
 col = getattr(table.c, my_integer_col)
 res = select(func.stdev(col)).execute().fetchone()
 
 where my_integer_col obviously contains only int values.
 I get the following error:
 ...
  File C:\Python26\lib\site-packages\sqlalchemy\engine\base.py, line
 2445, in _fetchone_impl
return self.cursor.fetchone()
  File C:\Python26\lib\site-packages\sqlalchemy\dialects\oracle
 \cx_oracle.py, line 496, in maybe_decimal
return int(value)
 ValueError: invalid literal for int() with base 10:
 '18,89258326656747167219869520430353668307'
 
 I think this is related with the usage of the comma decimal point in
 the results, but the error is raised by the cx_oracle module so I
 cannot handle it. is this a bug or am I missing something?
 Thanks in advance!
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To post to this group, send email to sqlalchemy@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 sqlalchemy@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.