Re: [Sqlalchemy-users] Select error

2006-09-18 Thread Michael Bayer
when you call select() off a Table, it selects all columns; the method does not accept a list of columns. to select only a subset of columns, do: select([users.c.login]).execute().fetchall() On Sep 18, 2006, at 4:24 AM, Enrico Morelli wrote: > Ok, the problem is very strange. Each select w

Re: [Sqlalchemy-users] Select error

2006-09-18 Thread Enrico Morelli
Ok, the problem is very strange. Each select with more than a WHERE clause, raise an exception. I use SQLAlchemy 0.2.8. >>> from sqlalchemy import * >>> engine=create_engine('postgres://[EMAIL PROTECTED]/DB') >>> metadata=BoundMetaData(engine) >>> users=Table('users',metadata, autoload=True) >>>

Re: [Sqlalchemy-users] Select error

2006-09-15 Thread Enrico Morelli
On Thu, 14 Sep 2006 11:27:26 -0400 Michael Bayer <[EMAIL PROTECTED]> wrote: > youre doing a SQL query, which is not directly compatible with the > querying method provided off of an ORM Query object (we differ from > Hibernate in that regard, which is somehow able to mix them all > together)

Re: [Sqlalchemy-users] Select error

2006-09-14 Thread Michael Bayer
youre doing a SQL query, which is not directly compatible with the querying method provided off of an ORM Query object (we differ from Hibernate in that regard, which is somehow able to mix them all together). you probably want to use the Table directly and do: self.plan.select ([self.plan

[Sqlalchemy-users] Select error

2006-09-14 Thread Enrico Morelli
Dear all, there is some syntax error in the following select? results = self.mysession.query(PlanEntry).select([self.plan.c.month,self.plan.c.instrument_id,func.count(self.plan.c.instrument_id)], and_(self.plan.c.year==int(year), self.plan.c.data.ilike('%%%s%%' % project)), group_by=[self.plan.c.