[sqlalchemy] memory and cpu usage growing like crazy

2008-06-18 Thread Arun Kumar PG
hi all folks, i have a search form that allows user to search for records. i am eager loading 4 attributes on the master object which results in 4 left outer joins in the sa's sql query. the problem is that when i look at the memory consumption using top command it looks crazy. the memory

[sqlalchemy] Re: memory and cpu usage growing like crazy

2008-06-18 Thread Arun Kumar PG
, session.clear() invoked and del session done. what's the best way to deal with the problem now... thanks, - A On Wed, Jun 18, 2008 at 7:49 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Jun 18, 2008, at 9:59 AM, Arun Kumar PG wrote: hi all folks, i have a search form that allows user to search

[sqlalchemy] Re: memory and cpu usage growing like crazy

2008-06-18 Thread Arun Kumar PG
structure associated as a part of initial orm.create_session call? i have not done a deep dive in sa source code but just guessing. On Wed, Jun 18, 2008 at 8:57 PM, Michael Bayer [EMAIL PROTECTED] wrote: On Jun 18, 2008, at 11:17 AM, Arun Kumar PG wrote: one more thing here, i noticed now

[sqlalchemy] IMPORTANT: Does SA caches objects in memory forever?

2007-12-06 Thread Arun Kumar PG
Hi All, I am having this problem with memory consumption when using SA. I have 200 MB ram allocated for the application and when I look at the usage statistics using top or any other memory monitor I see that after every request to the application the memory consumption is increasing and the

[sqlalchemy] Re: IMPORTANT: Does SA caches objects in memory forever?

2007-12-06 Thread Arun Kumar PG
FYI: I am using SA 0.3.9. On Dec 6, 2007 6:52 PM, Arun Kumar PG [EMAIL PROTECTED] wrote: Hi All, I am having this problem with memory consumption when using SA. I have 200 MB ram allocated for the application and when I look at the usage statistics using top or any other memory monitor I

[sqlalchemy] Profiling code to understand memory utilisation

2007-10-12 Thread Arun Kumar PG
I want profile my code to understand the amount of memory SA ORM uses during a handling a request. Does SA exposes some logging mechanism which can dump the usage like echo on engine ? -- Cheers, - A --~--~-~--~~~---~--~~ You received this message because you

[sqlalchemy] Many tables in eagerloading

2007-09-04 Thread Arun Kumar PG
Guys, Was wondering if we have 10 tables or so which are related to each other and are required during let's say report generation then if I specify eagerloading for all those attributes which are related to these tables then down the line as the records in the table grows the temp tables

[sqlalchemy] Re: Many tables in eagerloading

2007-09-04 Thread Arun Kumar PG
bit tough as many apps on that server and won't be easy as of now. On 9/4/07, Michael Bayer [EMAIL PROTECTED] wrote: On Sep 4, 2007, at 10:15 AM, Arun Kumar PG wrote: i thought so earlier but unfortunately i am on a lower version of mysql :( upgrade. -- Cheers

[sqlalchemy] Join in where and using .join()

2007-08-23 Thread Arun Kumar PG
Guys, Quick clarification: If we have two tables A and B with relationship keys 'XYZ' in both (B references A) then which is faster: 1) session.query(A).select_by(*[A.c.XYZ == B.c.XYZ]) or 2) session.query(A, B).join('XYZ') 2 should be faster as 1 may require more row scans ? Also, the

[sqlalchemy] Re: Ascii codec instead of unicode ?

2007-08-21 Thread Arun Kumar PG
Sounds good. Thanks Jason! On 8/20/07, jason kirtland [EMAIL PROTECTED] wrote: Arun wrote: So in short if I specify use_unicode=True at the SA engine level then I can skip specifying use_unicode and specify only charset=utf8 at mysqldb level ? If you configure this DB-API driver for

[sqlalchemy] Re: Ascii codec instead of unicode ?

2007-08-20 Thread Arun Kumar PG
So in short if I specify use_unicode=True at the SA engine level then I can skip specifying use_unicode and specify only charset=utf8 at mysqldb level ? On 8/19/07, jason kirtland [EMAIL PROTECTED] wrote: Arun Kumar PG wrote: Ok, you need to get that charset to the driver. Try removing

[sqlalchemy] Re: Ascii codec instead of unicode ?

2007-08-19 Thread Arun Kumar PG
why do we want to say use_unicode=0 instead or use_unicode=True here? On 8/16/07, jason kirtland [EMAIL PROTECTED] wrote: Ok you need to get tArun wrote: I am using mysqldb-1.2.2. I am passing 'SET NAMES' to connect method as a value for init_command parameter. All tables have utf8

[sqlalchemy] Re: Ascii codec instead of unicode ?

2007-08-16 Thread Arun Kumar PG
Whooops. the problem in coming on the box which is running mysqldb1.2.0. Actually it's a non-upgraded server with mysqldb 1.2.0. I was looking at the code on my box which contains 1.2.2. But I am sure that even with mysqldb 1.2.0 the existing SA version was working fine. and that's why

[sqlalchemy] Ascii codec instead of unicode ?

2007-08-15 Thread Arun Kumar PG
Hi All, Recently I upgraded to the version 3.9 of SA. Post that whenever I am trying to save characters in different language in the table I am getting the below exception: File /src/sqlalchemy/engine/base.py, line 601, in _execute raise exceptions.SQLError(context.statement,

[sqlalchemy] Re: Ascii codec instead of unicode ?

2007-08-15 Thread Arun Kumar PG
All tables are having a charset of utf8. Additionally, I am issuing SET NAMES 'utf8' statement as a part of connection establishment. Anything that is wrong here or missing ? On 8/15/07, jason kirtland [EMAIL PROTECTED] wrote: Arun Kumar PG wrote: Hi All, Recently I upgraded

[sqlalchemy] Re: Ascii codec instead of unicode ?

2007-08-15 Thread Arun Kumar PG
Yes. it's being done. I create the engine and then set convert unicode = True. On 8/15/07, Michael Bayer [EMAIL PROTECTED] wrote: are you using convert_unicode=True and/or the Unicode type ? On Aug 15, 2007, at 12:01 PM, Arun Kumar PG wrote: All tables are having a charset of utf8

[sqlalchemy] Re: Ascii codec instead of unicode ?

2007-08-15 Thread Arun Kumar PG
Any other clue that may be helpful in troubleshooting the cause ? On 8/15/07, Arun Kumar PG [EMAIL PROTECTED] wrote: Yes. it's being done. I create the engine and then set convert unicode = True. On 8/15/07, Michael Bayer [EMAIL PROTECTED] wrote: are you using convert_unicode=True

[sqlalchemy] Re: Ascii codec instead of unicode ?

2007-08-15 Thread Arun Kumar PG
to recap, you are setting the character set on the dbapi connection via the MySQLdb method in addition to issuing a manual SET NAMES query? Arun wrote: Any other clue that may be helpful in troubleshooting the cause ? On 8/15/07, Arun Kumar PG [EMAIL PROTECTED] wrote: Yes. it's being

[sqlalchemy] Re: *all* *new* *tutorials* !!!!

2007-08-06 Thread Arun Kumar PG
Cool. thx Michael! On 8/7/07, Michael Bayer [EMAIL PROTECTED] wrote: Hi gang - The documentation for 0.4 is undergoing tremendous changes, and is now released, in its almost-there format, at http://www.sqlalchemy.org/docs/04/ . The goal with these docs is not just to update to new 0.4

[sqlalchemy] Re: ConcurrentModificationError: Updated rowcount 0 does not match number of objects updated 1

2007-07-31 Thread Arun Kumar PG
. The FOUND_ROWS client flag must be enabled on MySQL connections to make rowcount return what you (and SA) are expecting. This has been enabled recently on SA 3.9 ? because the previous version was working fine. On 7/31/07, jason kirtland [EMAIL PROTECTED] wrote: Arun Kumar PG wrote: Looks like

[sqlalchemy] Re: ConcurrentModificationError: Updated rowcount 0 does not match number of objects updated 1

2007-07-31 Thread Arun Kumar PG
The MySQLdb library has CLIENT.FOUND_ROWS = 2. What value ideally it should have ? I am still now clear why this problem was not coming in the earlier SA version! On 7/31/07, Arun Kumar PG [EMAIL PROTECTED] wrote: I am using pool.QueuePool for managing connections and this pool is fed

[sqlalchemy] Re: ConcurrentModificationError: Updated rowcount 0 does not match number of objects updated 1

2007-07-31 Thread Arun Kumar PG
connect method. I don't know you didn't need this before though. Hope that helps, Simon -- *From:* sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Arun Kumar PG *Sent:* 31 July 2007 09:47 *To:* sqlalchemy@googlegroups.com *Subject

[sqlalchemy] Re: ConcurrentModificationError: Updated rowcount 0 does not match number of objects updated 1

2007-07-31 Thread Arun Kumar PG
will work even if I am creating an engine passing in a pool - right? Looks like something is going wrong somewhere in my code.. any helpful pointers for troubleshooting this down ? On 7/31/07, Michael Bayer [EMAIL PROTECTED] wrote: On Jul 31, 2007, at 3:40 AM, Arun Kumar PG wrote: Looks like

[sqlalchemy] Re: ConcurrentModificationError: Updated rowcount 0 does not match number of objects updated 1

2007-07-31 Thread Arun Kumar PG
Yeah this is what I did and it works. Was curious to know where the problem was. I guess I need to run through the code. Thanks Michael and all others! On 7/31/07, Michael Bayer [EMAIL PROTECTED] wrote: On Jul 31, 2007, at 10:48 AM, Arun Kumar PG wrote: As mentioned in my earlier email

[sqlalchemy] ConcurrentModificationError: Updated rowcount 0 does not match number of objects updated 1

2007-07-30 Thread Arun Kumar PG
Guys, I am using SA with MySQL. I am trying to update a record by making a call to session.update(obj). In response I am getting ConcurrentModificationError: Updated rowcount 0 does not match number of objects updated 1 What are the possible reasons for this error? -- Cheers, - A

[sqlalchemy] UnicodeDecodeError: 'utf8' codec can't decode bytes in position 94-96: invalid data

2007-07-25 Thread Arun Kumar PG
Guys, I am getting this error on reading data from a MySQL table. I have specified the charset of the table as utf-8 and collation utf8_general_ci. Do I need to do anything else ? Will *convert_unicode=True help? * -- Cheers, - A --~--~-~--~~~---~--~~ You

[sqlalchemy] Re: URGENT: 2014, Commands out of sync; you can't run this command now

2007-07-19 Thread Arun Kumar PG
PROTECTED] wrote: On Jul 15, 2007, at 11:24 PM, Arun Kumar PG wrote: Hi Michael, I figured out the problem. It was a connection sharing issue. Looks like different connection objects were getting returned from the pool (which was created using the creator approach in create_engine

[sqlalchemy] Re: URGENT: 2014, Commands out of sync; you can't run this command now

2007-07-19 Thread Arun Kumar PG
On 7/20/07, Michael Bayer [EMAIL PROTECTED] wrote: On Jul 19, 2007, at 2:08 PM, Arun Kumar PG wrote: Apologies for not responding for a while Was stuck in the project. Ok. So this is what happening The mapped objects are created during the first time request to the application. So

[sqlalchemy] Re: URGENT: 2014, Commands out of sync; you can't run this command now

2007-07-19 Thread Arun Kumar PG
Or, you can create your mapped objects per request, yes, or perhaps per thread. how much can this cost in terms of performance ? On 7/20/07, Michael Bayer [EMAIL PROTECTED] wrote: On Jul 19, 2007, at 4:39 PM, Arun Kumar PG wrote: Will this be a problem even if I attach a new session

[sqlalchemy] Re: URGENT: 2014, Commands out of sync; you can't run this command now

2007-07-19 Thread Arun Kumar PG
or may be just keep on using the QueuePool approach as it will always make sure to return the same connection to the current thread ? On 7/20/07, Arun Kumar PG [EMAIL PROTECTED] wrote: Or, you can create your mapped objects per request, yes, or perhaps per thread. how much can this cost

[sqlalchemy] Re: URGENT: 2014, Commands out of sync; you can't run this command now

2007-07-19 Thread Arun Kumar PG
That is what I am trying to figure out. It works perfectly when I do this. On 7/20/07, Michael Bayer [EMAIL PROTECTED] wrote: On Jul 19, 2007, at 5:06 PM, Arun Kumar PG wrote: or may be just keep on using the QueuePool approach as it will always make sure to return the same connection

[sqlalchemy] Re: URGENT: 2014, Commands out of sync; you can't run this command now

2007-07-19 Thread Arun Kumar PG
PM, Arun Kumar PG wrote: the stack trace points to pool.py (I will get the exact stack trace as I am away from my box currently) does the conflict occur frequently and easily with just a little bit of concurrency or is it something that only happens under very high load conditions

[sqlalchemy] Re: URGENT: 2014, Commands out of sync; you can't run this command now

2007-07-15 Thread Arun Kumar PG
everything and this does not crops up again :) Thanks for the support! - A On 7/13/07, Arun Kumar PG [EMAIL PROTECTED] wrote: Sure Michael I will get back on this in a while as I am researching on this. Thanks for your support. I hope this gets resolved sooner as I am very much dependent

[sqlalchemy] Re: URGENT: 2014, Commands out of sync; you can't run this command now

2007-07-13 Thread Arun Kumar PG
? On 7/13/07, Michael Bayer [EMAIL PROTECTED] wrote: On Jul 13, 2007, at 2:27 AM, Arun Kumar PG wrote: I create an orm session as soon as the request comes in and store the reference to the same in the curent thread i.e. threading.currentThread().session = new_session. This session is stored

[sqlalchemy] Re: URGENT: 2014, Commands out of sync; you can't run this command now

2007-07-13 Thread Arun Kumar PG
Sure Michael I will get back on this in a while as I am researching on this. Thanks for your support. I hope this gets resolved sooner as I am very much dependent on this and the application is really critical and should be up in next couple days! Thanks and i will get back on this in next couple

[sqlalchemy] how to call group_concat function in MySQL?

2007-04-22 Thread Arun Kumar PG
Hi Guys, How can I call group_concat() function in MySQL using the function gateway ? something like select([child, func.group_concat(Child.c.xxx).label(count)], group_by=[]).. any clue ? Thx - A --~--~-~--~~~---~--~~ You received this message because you are

[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

[sqlalchemy] Re: Child to parent - Uni-directional relationships - Is that supported ?

2007-04-13 Thread Arun Kumar PG
cool thx. On 4/13/07, svilen [EMAIL PROTECTED] wrote: I have a Parent - Child (1:N) relationship between Class and Exam table. Class - Exam 1 :N Now since a Class could have millions of Exam I don't want have an attribute on Class called exams. Instead I only want

[sqlalchemy] Re: Bit strange - no expunge required?

2007-04-12 Thread Arun Kumar PG
I think SessionContext makes senses especially for architecture involving multiple layers like mine where manager - DAO interaction happens. Thx Michael. On 4/12/07, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 11, 2007, at 11:15 PM, Arun Kumar PG wrote: Hi Michael, So how can I

[sqlalchemy] session.expunge() detaches all objects recursively?

2007-04-11 Thread Arun Kumar PG
Hi Guys, not tried but quick answer would help me: session.expunge()'ing an object would also expunge the child attributes which are relations ? e.g. expunging User object would also expunge user_addresses (a list of UserAddress object) ? Also, if I make any modification in the detached

[sqlalchemy] Bit strange - no expunge required?

2007-04-11 Thread Arun Kumar PG
Hi Guys, I am having two layers in my application: Manager and DAO. DAO deals with ORM and manager simply calls method on DAO. This is what I am doing in manager manager: rs = dao.getResults(params) obj = rs[0] some logic. obj.name = 'some name' dao.Update(obj) The getResults()

[sqlalchemy] Re: session.expunge() detaches all objects recursively?

2007-04-11 Thread Arun Kumar PG
cool. thx Michael! On 4/12/07, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 11, 2007, at 7:27 AM, Arun Kumar PG wrote: Hi Guys, not tried but quick answer would help me: session.expunge()'ing an object would also expunge the child attributes which are relations ? e.g. expunging

[sqlalchemy] Re: ORM dynamic query ?

2007-04-11 Thread Arun Kumar PG
Thx Michael. this looks better but can't I do a join here and specify absolute column names like {User.c.UserId..} session.query(User).select_by(**{id: 1, foo : bar}) thx - A On 4/12/07, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 11, 2007, at 9:56 AM, Arun Kumar PG wrote: Guys, I

[sqlalchemy] Re: Bit strange - no expunge required?

2007-04-11 Thread Arun Kumar PG
collected ? thx. - A On 4/12/07, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 11, 2007, at 11:45 AM, Arun Kumar PG wrote: Hi Guys, I am having two layers in my application: Manager and DAO. DAO deals with ORM and manager simply calls method on DAO. This is what I am doing in manager

[sqlalchemy] Re: Putting Session.flush in a seperate thread

2007-04-09 Thread Arun Kumar PG
may be a threadlocal strategy. On 4/9/07, Koen Bok [EMAIL PROTECTED] wrote: We are building a GUI app, and we were thinking about wrapping session.flush() in a thread with a timer that detects a timeout. That way we would have better performace and we can generate warnings if the connection

[sqlalchemy] One database Metadata - multiple sessions?

2007-04-08 Thread Arun Kumar PG
Hi All, Can we initialize metadata one time (let's say during the first time application access) , store the same in the global context and then reuse the already intialized metatada for catering multiple requests ? Any threading related issues ? So here is what I want to do and wanna confirm if

[sqlalchemy] Re: One database Metadata - multiple sessions?

2007-04-08 Thread Arun Kumar PG
Thx Michael! On 4/8/07, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 8, 2007, at 5:54 AM, Arun Kumar PG wrote: Hi All, Can we initialize metadata one time (let's say during the first time application access) , store the same in the global context and then reuse the already

[sqlalchemy] Re: Ordering by field in related object

2007-04-08 Thread Arun Kumar PG
Since I am new to SA just want if that means that even if we have an eager load on a 1:N relationships we should still do an explicit JOIN if the query involves columns from both side of relations? On 4/9/07, Michael Bayer [EMAIL PROTECTED] wrote: eagerly loaded relationships are not part of