[sqlalchemy] Simple problem with SQLite and Standard Deviation

2011-03-28 Thread Massi
Hi everyone, I'm using sqlalchemy 0.6.6 with SQLite...my problem is
simple, is there a way to compute standard deviation in sqlalchemy
with SQlite as a backend? I googled and found that native SQLite does
not support any aggregate function like MySQL 'stdev', but there exist
some extensions which could make it available. Does sqlalchemy support
something similar? Or can anyone point me out some (even ugly) hack to
work around the problem?
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] Simple problem with SQLite and Standard Deviation

2011-03-28 Thread Michael Bayer
you'd want to hook this in using a Python standard deviation function with 
sqlite3's create_aggregate():

http://docs.python.org/library/sqlite3.html#sqlite3.Connection.create_aggregate

SQLAlchemy can pass you the connection when first created via poollistener:

http://www.sqlalchemy.org/docs/core/interfaces.html?highlight=poollistener#sqlalchemy.interfaces.PoolListener

Then call any function with SQLA using func.name.   
func.my_standard_deviation_function(xyz)


On Mar 28, 2011, at 7:51 AM, Massi wrote:

 Hi everyone, I'm using sqlalchemy 0.6.6 with SQLite...my problem is
 simple, is there a way to compute standard deviation in sqlalchemy
 with SQlite as a backend? I googled and found that native SQLite does
 not support any aggregate function like MySQL 'stdev', but there exist
 some extensions which could make it available. Does sqlalchemy support
 something similar? Or can anyone point me out some (even ugly) hack to
 work around the problem?
 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.