[Tutor] updating Oracle tables via python

Liam Clarke cyresse at gmail.com
Wed Mar 30 02:13:02 CEST 2005


>From what little SQL I know, 

try using your quotation marks differently, see if it helps.

strUpdate = 'UPDATE table SET firstname = "JOSEPH" WHERE lastname = "SMITH" '

Good luck, 

Liam Clarke

On Tue, 29 Mar 2005 15:35:24 -0800, Williams, Thomas
<WilliTf at dshs.wa.gov> wrote:
> I have placed several print commands in the code before I submitted this
> question, both before and after the cursor.execute(strUpdate) command.  The
> script will print all of the print commands up to the
> cursor.execute(strUpdate) command, but not those after it.  Therefore, I
> think that the cursor.execute(strUpdate) is the source of the problem.
> Also, when I manually query the database, the records within the table have
> not been changed.
> 
> Thanks,
> 
> Tom
> 
> -----Original Message-----
> From: Liam Clarke [mailto:cyresse at gmail.com]
> Sent: Tuesday, March 29, 2005 3:23 PM
> To: Williams, Thomas
> Cc: tutor at python.org
> Subject: Re: [Tutor] updating Oracle tables via python
> 
> Is that all the code? It's not going to be giving you any feedback.
> Chuck a few print commands in it.
> 
> i.e.
> connection = cx_Oracle.connect("db/password at dbname")
> 
> cursor = connection.cursor()
> 
> print "Cursor created"
> 
> strUpdate = " UPDATE table SET firstname = 'JOSEPH'  WHERE lastname =
> 'SMITH' "
> 
> cursor.execute(strUpdate)
> 
> cursor.close()
> 
> connection.close()
> 
> print "completed"
> 
> When you query the database manually, are your changes there?
> 
> Regards,
> 
> Liam Clarke
> 
> On Tue, 29 Mar 2005 15:16:41 -0800, Williams, Thomas
> <WilliTf at dshs.wa.gov> wrote:
> >
> >
> >
> > Greetings,
> >
> > I am attempting to update an Oracle table using python.  When I execute
> the
> > code, the python script appears to hang, in that nothing else happens.
> >
> >
> >
> > As always, any assistance you can provide will be appreciated.
> >
> >
> >
> > Code:
> >
> >
> >
> > connection = cx_Oracle.connect("db/password at dbname")
> >
> > cursor = connection.cursor()
> >
> > strUpdate = " UPDATE table SET firstname = 'JOSEPH'  WHERE lastname =
> > 'SMITH' "
> >
> > cursor.execute(strUpdate)
> >
> > cursor.close()
> >
> > connection.close()
> >
> >
> >
> >
> >
> > Tom Williams
> >  DSHS - Research and Data Analysis Division
> >  14th and Jefferson, MS: 45204
> >  Olympia, WA  98504-5204
> >  360.902.0764
> >
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
> >
> >
> 
> --
> 'There is only one basic human right, and that is to do as you damn well
> please.
> And with it comes the only basic human duty, to take the consequences.
> 
> 


-- 
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.


More information about the Tutor mailing list