[storm] error on ResultSet.count( ) after group_by( )

Eduardo Willians edujurista at gmail.com
Fri Jan 23 16:28:34 GMT 2009


> from storm.expr import In, Min, Select
>
> subselect = Select(columns=[Ctb.op_id, Min(Ctb.expiration)],
> tables=[Ctb], group_by=Ctb.op_id)
> result = store.find(Ctb, In((Ctb.op_id, Ctb.expiration), subselect))
>
> You can probably modify this to fit your needs.

Thanks for your attention.

I did what you suggested but I got this:

Traceback (most recent call last):
  File "<pyshell#8>", line 1, in <module>
    x = result.any()
  File "C:\Python25\lib\site-packages\storm\store.py", line 1057, in any
    result = self._store._connection.execute(select)
  File "C:\Python25\lib\site-packages\storm\databases\mysql.py", line
106, in execute
    return Connection.execute(self, statement, params, noresult)
  File "C:\Python25\lib\site-packages\storm\database.py", line 203, in execute
    raw_cursor = self.raw_execute(statement, params)
  File "C:\Python25\lib\site-packages\storm\database.py", line 284, in
raw_execute
    self._check_disconnect(raw_cursor.execute, *args)
  File "C:\Python25\lib\site-packages\storm\database.py", line 325, in
_check_disconnect
    return function(*args, **kwargs)
  File "C:\Python25\Lib\site-packages\MySQLdb\cursors.py", line 166, in execute
    self.errorhandler(self, exc, value)
  File "C:\Python25\Lib\site-packages\MySQLdb\connections.py", line
35, in defaulterrorhandler
    raise errorclass, errorvalue
ProgrammingError: (1064, "You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right
syntax to use near ' credtb.expiration IN (SELECT credtb.op_id,
MIN(credtb.expiration) FROM ctb GROUP BY credtb.' at line 1")

That´s ok. I don't know what is happening exactly, but I'll solve the
problem working with result objects individually and seperating the
objects I want, I'll just use a 'set( )' object and some iterations.
As my knowlodges on Storm increases I'll find out the sentence I
should work with.

Thanks anyway,

Eduardo Willians



More information about the storm mailing list