[sqlalchemy] Re: large tables

2007-04-19 Thread Michael Bayer
On Apr 19, 2007, at 8:50 PM, Karthik Krishnamurthy wrote: > How does sqlalchemy behave when querying tables with large number > of rows. I see it constructing a query and getting all results and > mapping > them into instances before iterating through them for a query like > > for node in op

[sqlalchemy] large tables

2007-04-19 Thread Karthik Krishnamurthy
How does sqlalchemy behave when querying tables with large number of rows. I see it constructing a query and getting all results and mapping them into instances before iterating through them for a query like for node in opsdb.queryNodes(): print node Is there a way to change this behaviour

[sqlalchemy] subquery using the ORM

2007-04-19 Thread Karthik Krishnamurthy
Hi, Given the application in the attached file how do I query for nodes that belong to groupNode id's 1 AND 2. /kk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send em

[sqlalchemy] Re: how to add whereclause string

2007-04-19 Thread vkuznet
Regarding attack, I'm doing read-only application using read-only account, so insert/ updates are forbidden to users, as well as I'm not passing "blindly" such query. As I said only where clause is exposed to the user not query itself. And such where clause in my hand before I'm passing it to unde

[sqlalchemy] Re: how to add whereclause string

2007-04-19 Thread Michael Bayer
On Apr 19, 2007, at 12:37 PM, vkuznet wrote: > > Hi, > I'm developing a web application where users are allowed to specify > where statement. So I can capture it as a string, e.g. > ( T1.C1=1 OR T1.C1=5) AND T3.C3 like 'test%' > > where T1 is table 1 and C1 is column 1, and so on. Now the hard

[sqlalchemy] Re: transaction commit problem

2007-04-19 Thread Huy Do
Michael Bayer wrote: > On Apr 19, 2007, at 11:52 AM, Huy Do wrote: > > >> I have the following code >> >> trans = db.engine.contextual_connect().begin >> try: >> for client_id in slist.keys(): >> job_insert.execute( ) >> job_id = engin

[sqlalchemy] how to add whereclause string

2007-04-19 Thread vkuznet
Hi, I'm developing a web application where users are allowed to specify where statement. So I can capture it as a string, e.g. ( T1.C1=1 OR T1.C1=5) AND T3.C3 like 'test%' where T1 is table 1 and C1 is column 1, and so on. Now the hard question is how to add such string to sqlalchemy query? I've

[sqlalchemy] Re: transaction commit problem

2007-04-19 Thread Michael Bayer
On Apr 19, 2007, at 11:52 AM, Huy Do wrote: > > I have the following code > > trans = db.engine.contextual_connect().begin > try: > for client_id in slist.keys(): > job_insert.execute( ) > job_id = engine.func.currval('job_id_seq').scal

[sqlalchemy] transaction commit problem

2007-04-19 Thread Huy Do
Hi, I am having problems getting transactions working. I am calling conn.begin() but before I call trans.commit(), something else commits for me. It is committing right after I do the job_insert.execute(). Can someone shed some light. Many Thanks Huy I have the following code trans

[sqlalchemy] Re: order_by on related object attribute?

2007-04-19 Thread Michael Bayer
On Apr 19, 2007, at 9:39 AM, Gaetan de Menten wrote: > By the way, lately I've been wishing SQLAlchemy would add a column > (and possibly its table) automatically to the select clause if I do an > order by a column which is not in the currently selected columns. > > I mean that you could write:

[sqlalchemy] Re: order_by on related object attribute?

2007-04-19 Thread Gaetan de Menten
On 4/18/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Apr 18, 2007, at 12:21 AM, Chris Shenton wrote: > > > > > I'm using SQLAlchemy with Pylons and query my 'system' table and order > > by their client_id field like: > > > > from er.models import System, Vendor, Client > > sys = self.sess

[sqlalchemy] Re: shutdown database connection

2007-04-19 Thread Michael Bayer
engine.dispose() On Apr 19, 2007, at 8:44 AM, Denis Shaposhnikov wrote: > > Hi! > > I'm using PostgreSQL and it logs > > postgres[45846]: [2-1] LOG: unexpected EOF on client connection > > on the exit of my application. I think that I need somehow to shutdown > the connection to the databa

[sqlalchemy] Re: detached instance or is already persistent in a different Sess

2007-04-19 Thread jose
I solved it using self.record.save_or_update() j Arun Kumar PG wrote: > Looks like you are trying to use objects across different sessions. > > try to do an explicit session.expunge(obj) to the first object > returned before use the object in other session. > > On 4/19/07, *jose* <[EMAIL PRO

[sqlalchemy] shutdown database connection

2007-04-19 Thread Denis Shaposhnikov
Hi! I'm using PostgreSQL and it logs postgres[45846]: [2-1] LOG: unexpected EOF on client connection on the exit of my application. I think that I need somehow to shutdown the connection to the database. But how to do it with SA? Thanks! -- DSS5-RIPE DSS-RIPN 2:550/[EMAIL PROTECTED] 2

[sqlalchemy] Re: detached instance or is already persistent in a different Sess

2007-04-19 Thread Arun Kumar PG
Looks like you are trying to use objects across different sessions. try to do an explicit session.expunge(obj) to the first object returned before use the object in other session. On 4/19/07, jose <[EMAIL PROTECTED]> wrote: > > > hi group, > > I have the following error that I don't know how to s

[sqlalchemy] detached instance or is already persistent in a different Sess

2007-04-19 Thread jose
hi group, I have the following error that I don't know how to solve... * -- *self.record = Comune.get(pk) *... *self.record.get_from_dict(data=data,update=True) if self.record._state['modified']: self.record.save() *sqlalchemy.exceptions.Inv

[sqlalchemy] Re: Subquery error with MySQL : SQLAlchemy bug ?

2007-04-19 Thread [EMAIL PROTECTED]
Thanks a bunch Michael, you really saved my day. Keep up the very good work. Thanks again. Sebastien Michael Bayer wrote: > On Apr 18, 2007, at 11:43 AM, [EMAIL PROTECTED] wrote: > > >> Hi Guys, >> >> I am trying to do this simple update query : >> >> s=select([table1.c.mo_id],and_ >> (t