Michael, On May 22, 6:03 pm, "Michael Bayer" <[email protected]> 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 - just wanted to find out whether I do understand the limitations of the database itself correctly. > if your database supports SAVEPOINT, this usage pattern can be achieved > using begin_nested() to start a SAVEPOINT (but not with 0.4...). > Otherwise, you have to query the database first for your value - and you > might need to use table locks to prevent concurrent inserts. In my original line of thinking this would probably be the "best" solution. But they way ids are generated (using sequences on postgresql, for example) just seems far superior: you don't have to worry about stuff like transactions, locking, etc - you just get the next, unique number. It would have been nice if there was some DB support for a random "sequence-like" thing. But I suppose my key can always consist of the id generated by the db + some random component. > > This is done with SqlAlchemy 0.4 (and Elixir 0.5), on postgresql 8.3. > > if you just started with SQLAlchemy, why 0.4 ? 0.5 has been out in final > release for six months. Yup, thanks I saw that... We need to be on a LTS version of Ubuntu, the latest of which is hardy - and it is still on 0.4... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
