I cant find in the PG docs why it would raise this but the DISTINCT is
not needed here.
On Dec 8, 2008, at 6:05 AM, Ash wrote:
>
> Hello ,
>
> I am usinng sqlalchemy for making the sum on column i am using
> sqlalchemy.func.sum (col_name).
>
> I am getting the error while dng it .
>
> Code snnipet
> ----------------
> aggregator=sqlalchemy.func.sum('product_sold')
> make_select = sqlalchemy.select(from_obj=[sales],columns=
> [aggregator],distinct=True)
> query = make_select.execute()
> result = query.fetchall()
>
>
> Error trace
> ----------
>
> query = make_select.execute()
> File "/var/lib/python-support/python2.5/sqlalchemy/sql/
> expression.py", line 1087, in execute
> return e.execute_clauseelement(self, multiparams, params)
> File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
> line 1219, in execute_clauseelement
> return connection.execute_clauseelement(elem, multiparams, params)
> File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
> line 895, in execute_clauseelement
> return self._execute_compiled(elem.compile(dialect=self.dialect,
> column_keys=keys, inline=len(params) > 1), distilled_params=params)
> File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
> line 907, in _execute_compiled
> self.__execute_raw(context)
> File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
> line 916, in __execute_raw
> self._cursor_execute(context.cursor, context.statement,
> context.parameters[0], context=context)
> File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
> line 960, in _cursor_execute
> self._handle_dbapi_exception(e, statement, parameters, cursor)
> File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py",
> line 942, in _handle_dbapi_exception
> raise exceptions.DBAPIError.instance(statement, parameters, e,
> connection_invalidated=is_disconnect)
> sqlalchemy.exceptions.ProgrammingError: (ProgrammingError) function
> sum
> (unknown) is not unique
>
>
> 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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---