Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36294
| References | <185b6d9e-99ce-4f2a-81ea-d9a63b81b4cf@googlegroups.com> <mailman.187.1357508761.2939.python-list@python.org> <10bc4895-21e3-4a56-84fd-b0830e42acfa@googlegroups.com> <50E9F74A.70107@lightbird.net> |
|---|---|
| Date | 2013-01-07 09:19 +1100 |
| Subject | Re: psycopg2 cursor.execute CREATE TABLE issue |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.191.1357510798.2939.python-list@python.org> (permalink) |
On Mon, Jan 7, 2013 at 9:14 AM, Mitya Sirenef <msirenef@lightbird.net> wrote: > On Sun 06 Jan 2013 04:53:32 PM EST, andydtaylor@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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
psycopg2 cursor.execute CREATE TABLE issue andydtaylor@gmail.com - 2013-01-06 13:38 -0800
Re: psycopg2 cursor.execute CREATE TABLE issue Mitya Sirenef <msirenef@lightbird.net> - 2013-01-06 16:44 -0500
Re: psycopg2 cursor.execute CREATE TABLE issue Walter Hurry <walterhurry@lavabit.com> - 2013-01-06 22:37 +0000
Re: psycopg2 cursor.execute CREATE TABLE issue Chris Angelico <rosuav@gmail.com> - 2013-01-07 08:45 +1100
Re: psycopg2 cursor.execute CREATE TABLE issue andydtaylor@gmail.com - 2013-01-06 13:53 -0800
Re: psycopg2 cursor.execute CREATE TABLE issue Mitya Sirenef <msirenef@lightbird.net> - 2013-01-06 17:14 -0500
Re: psycopg2 cursor.execute CREATE TABLE issue Chris Angelico <rosuav@gmail.com> - 2013-01-07 09:19 +1100
Re: psycopg2 cursor.execute CREATE TABLE issue andydtaylor@gmail.com - 2013-01-06 13:53 -0800
csiph-web