I have a Article table may relate with a Room table and I want to find
Article sometime with Room.name.
So I wrote the code like below.
query = meta.Session.query(Article)
query = query.outerjoin('rooms')
if room_name is not None:
query = query.filter(Room.name == room_name)
query =
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Hollister
Sent: 20 June 2009 02:15
To: sqlalchemy
Subject: [sqlalchemy] Re: aggregation with count and
webhelpers.paginate
Well, that worked great:
q =
Oops. I found the solution with my self.
like below.
c.paginator = paginate.Page(
meta.Session.query(Article).select_from(query.subquery()),
page=int(request.params.get('page',1)),
items_per_page=int(request.params.get('items_per_page', 10))
)
But why can't I do like
Hello
after falling in love with SQLAlchemy I'm trying to transform most of
my raw SQL-Statements into ORM-Queries.
I'm using cx_Oracle 4.3.3, SQLAlchemy 0.5.4p2 and Oracle 10.2.0.4.0
under Windows XP with Python 2.5.2.
At the moment I'm stuck with this statement (most columns are replaced
with
Alisue wrote:
Oops. I found the solution with my self.
like below.
c.paginator = paginate.Page(
meta.Session.query(Article).select_from(query.subquery()),
page=int(request.params.get('page',1)),
items_per_page=int(request.params.get('items_per_page', 10))
)
But
Tobias Bell wrote:
Hello
after falling in love with SQLAlchemy I'm trying to transform most of
my raw SQL-Statements into ORM-Queries.
I'm using cx_Oracle 4.3.3, SQLAlchemy 0.5.4p2 and Oracle 10.2.0.4.0
under Windows XP with Python 2.5.2.
At the moment I'm stuck with this statement (most
You could also use a label to avoid the repetition:
from sqlalchemy.sql import desc
meta.Session.query(m.Hit.referer, func.count(m.Hit.id).label('count'))\
.group_by(m.Hit.referer)\
.order_by(desc('count'))
On Mon, Jun 22, 2009 at 2:22 AM, King
Hi
I've got a small problem with my python code proted from 0.5 (p2.5) to
0.4.6 (p2.3).
When I try to load query objects from many-to-many relation (mapped
via secondary keyword) I get most weird error:
Traceback (most recent call last):
File string, line 86, in ?
File X, line 17, in
that error would have something to do with pickling, direct __dict__
access on instances, or playing around with instrumentation extensions.
that's as much as can be said based on what you've given.
aside from whatever reasons for using Py2.3, why ever would you go
straight to 0.4.6 and not
Hi
I'm a bit concerned why the same code works with SA 0.5. Actually when
there is no data in the relation, the query returns an empty list;
however, as soon as I put some data in, I got the error :O
I tried with 0.4.9dev...something as well, the same result though :/
Am missing the point here?
david.radkow...@googlemail.com wrote:
Hi
I'm a bit concerned why the same code works with SA 0.5. Actually when
there is no data in the relation, the query returns an empty list;
however, as soon as I put some data in, I got the error :O
I tried with 0.4.9dev...something as well, the same
Hi,
I am doing a search across two tables for matching records, and I'm
not quite sure how to work with the results of the query. For example:
matches = session.query(TableA).from_statement(SELECT tableA.id,
tableB.id FROM tableA, tableB WHERE etc)
To me this doesn't really fit the model.
12 matches
Mail list logo