[DB-SIG] PoPy v2.0.1 user competency issues

Timothy Grant tjg@exceptionalminds.com
Wed, 28 Feb 2001 11:32:37 -0800

Hi all,

Two things:

First of all, I have a feeling my lack of knowledge about how a
database interface is supposed to work is hindering my ability
to understand why PoPy is misbehaving.

Here's what I am doing:

I get a large quantity of data from an external data source.

I parse the data, and then build two SQL queries from it: one
that does an insert and one that does an update.

I then attempt to do an insert in a try/except block.

If the insert fails, I know that I have to do an update and I
execute the update in the except block.

I started using this before I installed v2.0.1. I also turned
autocommit on.

I get the feeling that while my code was running it was not
working correctly at all.

I installed PoPy v2.0.1 and something happened to autocommit.
So I commented out all the lines having to do with autocommit
and proceeded on my merry way. Now, however, I get the
following output from my both my test programme and the "real"
programme. Could some one improve my understanding of how these
things are supposed to work, and what silliness I have

Posted below is the output from my programme, and then below
that the test script itself.

Thanks for any input you may have.

[homer rmls]$ ./test.py 
Attempting Insert
Attempting Update
NOTICE:  current transaction is aborted, queries ignored until
end of transaction block

from PoPy import *

#Database settings
dbname     = 'foobar'
dbusername = 'tjg'
dbhost     = 'localhost'


def main():
    db = connect('dbname=%s user=%s host=%s' % (dbname,
	dbusername, dbhost))

	sqlin = "insert into test values (11, 'Jennifer', '503-555-1212');"
    sqlup = "update test set name = 'Jennifer' where id = 11;"

        print 'Attempting Insert'
        cr = db.cursor()
        print 'Attempting Update' 
		cr = db.cursor()

I have a feeling my vim newbieness may have messed up the
indentation on the above, though I'm not sure.

Stand Fast,

Timothy Grant                         tjg@exceptionalminds.com
Red Hat Certified Engineer            www.exceptionalminds.com
Avalon Technology Group, Inc.         <><       (503) 246-3630
>>>>>>>>>>>>>Linux, because rebooting is *NOT* normal<<<<<<<<<
>>>>This machine was last rebooted:  42 days 23:27 hours ago<<