Re: I'm very confused. - Mailing list pgsql-novice

From Sean Davis
Subject Re: I'm very confused.
Date
Msg-id 200701170625.01471.sdavis2@mail.nih.gov
Whole thread Raw
In response to Re: I'm very confused.  (Brant Fitzsimmons <brant@bfcomputerconsulting.com>)
Responses Re: I'm very confused.  (Brant Fitzsimmons <brant@bfcomputerconsulting.com>)
List pgsql-novice
On Wednesday 17 January 2007 03:06, Brant Fitzsimmons wrote:
> Jasbinder Singh Bali wrote:
> > Please attach a snippet of your python script and lets see what are
> >  you doing there. That might make things easy. Jas
>
> Here is the entire test script:
>
> #!/usr/bin/python
>
> # import pgdb module
> import pgdb
>
> # connect to the db
> db = pgdb.connect(host="localhost", database="test", user="postgres",
> password="**********")
>
> # instantiate cursor
> cursor = db.cursor()
>
> # insert 10 records
> for x in range(10):
>     cursor.execute("INSERT INTO users (username, firstname, lastname,
> email, age) VALUES ('brant', 'Brant', 'Fitzsimmons',
> 'brant@bfcomputerconsulting.com', 31)")

Put in a db.commit() statement here.  Does that fix your problem?

> # retrieve the data
> cursor.execute("SELECT * FROM users")
> result = cursor.fetchall()
>
> # print data to the screen
> for line in result:
>     print line
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

pgsql-novice by date:

Previous
From: Brant Fitzsimmons
Date:
Subject: Re: I'm very confused.
Next
From: "Jasbinder Singh Bali"
Date:
Subject: Re: I'm very confused.