[DB-SIG] PoPy v2.0.1 user competency issues
Thu, 1 Mar 2001 11:42:04 +0000
This problem is that postgresql exits the transaction when an error
I prepare a patch to resolv this problem, I notice you and the DB-API
list when it's fixed.
On Wed, Feb 28, 2001 at 11:32:37AM -0800, Timothy Grant wrote:
> 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 email@example.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<<
> DB-SIG maillist - DB-SIG@python.org
Nekhem Technologies France
200, rue Michel de Montaigne
84911 AVIGNON Cedex 09
"Sainthood in the Church of Emacs requires living a life of purity,
but in the Church of Emacs, this does not require celibacy."