[sqlalchemy] Re: Creating something with a unique, random key

2009-05-24 Thread Iwan
Michael, On May 22, 6:03 pm, Michael Bayer mike...@zzzcomputing.com wrote: have you considered using some more industrial strength randomness, like GUIDs generated from the current timestamp or similar ?    the python uuid module works very well for this. That's probably the direction I'd go

[sqlalchemy] Re: Creating something with a unique, random key

2009-05-24 Thread Iwan
Adrian, On May 22, 7:45 pm, Adrian von Bidder avbid...@fortytwo.ch wrote: I guess you just have to query for your string to see if it's unique.   Performance-wise it shouldn't make a difference, and in Python, I usually find a simple if even nicer than a try-except block. Yup, thanks, that

[sqlalchemy] Re: session.autocommit, session.begin double SessionExtension call

2009-05-24 Thread Alessandro Dentella
On Sat, May 23, 2009 at 02:43:33PM -0400, Michael Bayer wrote: On May 23, 2009, at 10:15 AM, Alessandro Dentella wrote: Hi, when from my pygtk application i commit, I really do:: if self.session.autocommit: self.session.begin()

[sqlalchemy] Re: session.autocommit, session.begin double SessionExtension call

2009-05-24 Thread Michael Bayer
well the begin() in this case is doing a flush() of pending data to ensure that it starts clean - otherwise if you said rollback(), the state which to roll back to would not be determined.then since you have autocommit=True its issuing a COMMIT. so a COMMIT is happening and if you

[sqlalchemy] Re: Q: fetch value of autoincrement column

2009-05-24 Thread Werner F. Bruhin
Adrian von Bidder wrote: On Friday 22 May 2009 23.00:05 Werner F. Bruhin wrote: What do you want to do with the autoincrement column? Often these are used for primary keys, which in turn get used as foreign keys. I want to use the id as filename; the table will cache some info

[sqlalchemy] Re: TimeoutError: QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30

2009-05-24 Thread Jeff FW
You need to make sure that you are closing your sessions--otherwise, they keep your connections open, and are never returned to the pool. Make sure to read up on sessions here: http://www.sqlalchemy.org/docs/05/session.html Also, read up on logging:

[sqlalchemy] Re: Q: fetch value of autoincrement column

2009-05-24 Thread Alexandre Conrad
Hello Adrian, In my case, I actually build up my SA model, flush it, and save the file on disk using the id that's been populated on my object after flush. Sorry, your original question didn't really give enough details on what you wanted to do. What you were trying to achieve is not common