Actually, if TRANS_TYPE is a mapped attribute of the RecordClass class
(or whatever its name is), it should be Records.c.TRANS_TYPE. Also,
group_by does not take a list but all individual columns as parameters
(so just omit those []s).

On 10 Okt., 17:38, "Lukasz Szybalski" <[EMAIL PROTECTED]> wrote:
> On Fri, Oct 10, 2008 at 10:32 AM, Simon <[EMAIL PROTECTED]> wrote:
>
> > The statement looks good in my book...what does "system error" mean
> > exactly?
>
> > On 10 Okt., 17:15, "Lukasz Szybalski" <[EMAIL PROTECTED]> wrote:
> >> Hello,
> >> Could anybody tell me what is wrong with this select statement?
>
> >> Records is a mapper.
>
> >> group=sqlalchemy.select([Records.TRANS_TYPE,Records.TR_DATE,func.count(Records.TR_DATE).label('date_count')],
> >> Records.TRANS_TYPE==29).group_by([Records.TRANS_TYPE,Records.TR_DATE]).execute().fetchall()
>
> >> I get system error..
>
> >> Ideas?
>
> >> I can't find a full example that works nowhere on the doc pages.
>
> >> Thanks,
> >> Lucas
>
> >> --
>
> Did I do the where statement correctly?
>
> Lucas
>
> here is the error.//.
>
>  File 
> "/usr/local/pythonenv/BASELINE2/lib/python2.4/site-packages/SQLAlchemy-0.5.0rc1-py2.4.egg/sqlalchemy/sql/expression.py",
> line 1108, in execute
>     return e.execute_clauseelement(self, multiparams, params)
>   File 
> "/usr/local/pythonenv/BASELINE2/lib/python2.4/site-packages/SQLAlchemy-0.5.0rc1-py2.4.egg/sqlalchemy/engine/base.py",
> line 1227, in execute_clauseelement
>     return connection.execute_clauseelement(elem, multiparams, params)
>   File 
> "/usr/local/pythonenv/BASELINE2/lib/python2.4/site-packages/SQLAlchemy-0.5.0rc1-py2.4.egg/sqlalchemy/engine/base.py",
> line 899, in execute_clauseelement
>     return self._execute_compiled(elem.compile(dialect=self.dialect,
> column_keys=keys, inline=len(params) > 1), distilled_params=params)
>   File 
> "/usr/local/pythonenv/BASELINE2/lib/python2.4/site-packages/SQLAlchemy-0.5.0rc1-py2.4.egg/sqlalchemy/engine/base.py",
> line 911, in _execute_compiled
>     self.__execute_raw(context)
>   File 
> "/usr/local/pythonenv/BASELINE2/lib/python2.4/site-packages/SQLAlchemy-0.5.0rc1-py2.4.egg/sqlalchemy/engine/base.py",
> line 920, in __execute_raw
>     self._cursor_execute(context.cursor, context.statement,
> context.parameters[0], context=context)
>   File 
> "/usr/local/pythonenv/BASELINE2/lib/python2.4/site-packages/SQLAlchemy-0.5.0rc1-py2.4.egg/sqlalchemy/engine/base.py",
> line 962, in _cursor_execute
>     self.dialect.do_execute(cursor, statement, parameters, context=context)
>   File 
> "/usr/local/pythonenv/BASELINE2/lib/python2.4/site-packages/SQLAlchemy-0.5.0rc1-py2.4.egg/sqlalchemy/databases/mssql.py",
> line 814, in do_execute
>     super(MSSQLDialect_pyodbc, self).do_execute(cursor, statement,
> parameters, context=context, **kwargs)
>   File 
> "/usr/local/pythonenv/BASELINE2/lib/python2.4/site-packages/SQLAlchemy-0.5.0rc1-py2.4.egg/sqlalchemy/databases/mssql.py",
> line 490, in do_execute
>     cursor.execute("SET IDENTITY_INSERT %s OFF" %
> self.identifier_preparer.format_table(context.compiled.statement.table))
> SystemError: 'finally' pops bad exception
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to