[sqlalchemy] Re: How to diagnose a transaction hang problem?

2010-02-01 Thread
, Alex Brasetvik a...@brasetvik.com wrote: On Jan 29, 2010, at 15:01 , 一首诗 wrote: What might cause this kind of problem? Possibly waiting on locks. Do you have any concurrent transactions modifying the same data? When the problem appears, run `select * from pg_stat_activity` to see

[sqlalchemy] Re: How to diagnose a transaction hang problem?

2010-01-30 Thread
fascinating stuff. But your immediate problem is very likely just a session/connection that you forget to close.) Regards,     - Gulli On Jan 30, 4:53 am, 一首诗 newpt...@gmail.com wrote: Yeah, there might be another transaction modifying the same data (actually the same line of data in database

[sqlalchemy] How to diagnose a transaction hang problem?

2010-01-29 Thread
Today I met a strange problem with SqlAlchemy and Postgresql. The code is like this: def update_user(user_id, sess): user = sess.query(User).get(user_id).one() user.last_activity_time = datetime.now() session.commit() It hangs here forever. In the code above,

[sqlalchemy] Re: How to diagnose a transaction hang problem?

2010-01-29 Thread
Brasetvik a...@brasetvik.com wrote: On Jan 29, 2010, at 15:01 , 一首诗 wrote: What might cause this kind of problem? Possibly waiting on locks. Do you have any concurrent transactions modifying the same data? When the problem appears, run `select * from pg_stat_activity` to see whether

[sqlalchemy] What might cause QueuePool limit of size 5 overflow 10 reached?

2009-08-13 Thread
I occasionally got QueuePool limit of size 5 overflow 10 reached. I don't call session.close() after I don't need them. Because I think GC will do that. But now, it seems that I am losting connections somewhere. Should I call session.close after I use them? Should I use try.. finally... to

[sqlalchemy] Should we separate business logic and ORM mapping classes.

2009-04-12 Thread
Hi, Usually, I only use ORM, like pyamf just as an abstraction layer of database. So these mapping objects I wrote only contains data but not behavior. For example, if I have a class User, I would write another class UserManager which with a methods like addUser, delUser. But recently I am

[sqlalchemy] Re: Any one tried to use SqlAlchemy with XML RPC?

2009-03-19 Thread
- Hash: SHA1 On 19.03.2009 5:24 Uhr, 一首诗 wrote: This is my ORM class definition: #= class User(Base): __tablename__ = 'b_taa_user' user_id = Column(Integer, primary_key=True, autoincrement=True, nullable=False) # 用户ID user_name = Column

[sqlalchemy] Re: Any one tried to use SqlAlchemy with XML RPC?

2009-03-18 Thread
at 11:46 PM, 一首诗 newpt...@gmail.com wrote: Hi, I am trying to pass SqlAlchemy objects to client with XML RPC, but it seems that that's not very easy. It depends on what you are trying to do, and what error messages you are getting, for anyone to help. I am using XML RPC with SQLAlchemy

[sqlalchemy] Re: Using sqlalchemy in twisted.

2009-03-11 Thread
? If not, I'd suggest changing everything in it into class methods, so that way you can call it *without* an instance at all, and don't have to worry about connecting to the database multiple times by accident. Just a thought. -Jeff On Mar 10, 10:38 am, 一首诗 newpt...@gmail.com wrote: Hi Jeff

[sqlalchemy] Re: Using sqlalchemy in twisted.

2009-03-10 Thread
) are decorators for logging and other types of error handling (like catching IntegrityErros thrown by duplicates.) I do those things, but I might be a bit OCD :-) -Jeff On Mar 7, 1:41 am, 一首诗 newpt...@gmail.com wrote: Hi, Thanks for your reply. I'm using it the way like you. The only

[sqlalchemy] Re: Using sqlalchemy in twisted.

2009-03-04 Thread
classes are used everywhere in my application. On Mar 4, 7:26 pm, 一首诗 newpt...@gmail.com wrote: Hi, all I am using sqlalchemy in twisted in my project in the way below. Defer any database operation so the twisted's main thread won't be blocked. And I use scoped_session, so that sessions

[sqlalchemy] An instance's attributes lost while the other updated.

2009-02-25 Thread
Hi all, I have 2 user instance in a session and after I have update one of it like this --- u = session.merge(u) session.commit session.refresh(u)

[sqlalchemy] What's the use of expunge?

2009-02-25 Thread
The document says: Expunge removes an object from the Session, sending persistent instances to the detached state, and pending instances to the transient state: I hoped that if an

[sqlalchemy] Re: An instance's attributes lost while the other updated.

2009-02-25 Thread
. ## u1 = session.merge(u1) print -- print u2 session.commit() print -- print us ## On Feb 26, 2:17 pm, 一首诗 newpt...@gmail.com wrote: Hi all, I have 2 user instance in a session and after I have update

[sqlalchemy] How to write a self 2 self relationship?

2009-02-16 Thread
I tried to write : # class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(String) fullname = Column(String) password = Column(String) sons =

[sqlalchemy] Re: How to write a self 2 self relationship?

2009-02-16 Thread
a 'primaryjoin' expression. If this is a many-to-many relation, 'secondaryjoin' is needed as well. On Feb 16, 5:08 pm, a...@svilendobrev.com wrote: put it as text, it will be eval()'uated later On Monday 16 February 2009 10:57:11 一首诗 wrote: I tried to write

[sqlalchemy] Problem of Unicode Strings

2009-02-11 Thread
Hi all, I'm using sqlalchemy as my ORM library and it works fines until today one of my test case fail === sqlalchemy.exc.ProgrammingError: (ProgrammingError) You must not use 8- bit bytestrings unless you use a text_factory that can interpret

[sqlalchemy] You must not use 8-bit bytestrings ??

2009-02-11 Thread
Hi all, I'm using sqlalchemy as my ORM library and it works fines until today one of my test case fail === sqlalchemy.exc.ProgrammingError: (ProgrammingError) You must not use 8- bit bytestrings unless you use a text_factory that can interpret