On Mon, Jan 7, 2013 at 9:14 AM, Mitya Sirenef <msire...@lightbird.net> wrote: > On Sun 06 Jan 2013 04:53:32 PM EST, andydtay...@gmail.com wrote: >> >> Wow it's as simple as that! I'm afraid my database experience is in >> Microsoft Access in Windows and not at the command line, so that wasn't >> intuitive for me. >> > IIRC I made the same mistake when I was using psycopg for the first time. > I think wrapper libraries like sqlalchemy usually have myrecord.save() > method which is more intuitive.
I recommend getting used to thinking in terms of transactions and commits. Instead of saving a record, commit a unit of work, which might involve several changes all at once. A good database (like PostgreSQL) will guarantee you that either the whole transaction has happened, or none of it has. And normally, once your commit call has returned (assuming it doesn't raise an error), you're guaranteed that the transaction has been completely written to durable storage. Of course, that depends on *having* durable storage, and many SSDs lie about what's been written, but that's outside the scope of this post! ChrisA -- http://mail.python.org/mailman/listinfo/python-list