Re: [cx-oracletools-users] Problem with DumpCSV vs. CLOBs
Brought to you by:
atuining
|
From: Anthony T. <ant...@gm...> - 2008-03-03 16:18:43
|
Hmm, that is quite strange. I'm not sure why the earlier code would have caused it to never complete but the newer code you suggested is better in any case. It works in Python 2.2 and higher and I have absolutely no interest in anything earlier than that anyway. :-) I've applied your patch to the Subversion repository. Thanks. Anthony On Mon, Mar 3, 2008 at 8:40 AM, Hancock, David (DHANCOCK) <DHA...@ar...> wrote: > > I found an earlier message about a problem dumping BLOBs and CLOBs, too > (September 2007). We just started encountering an issue, also, but our > symptom was just that the job never finished, so we found old processes from > many days ago still connected when we tried to shut down our database. (When > we run the job in the foreground, we get an error message about having > already fetched the LOB.) > > My coworker identified a fix. The extent of our testing has been to > demonstrate the problem, make this patch, and then run the same job and > watch it run to completion. Here's the diff for DumpCSV.py: > > --- DumpCSV.py.dist 2008-03-03 14:14:14.000000000 +0000 > +++ DumpCSV.py 2008-03-03 15:03:51.000000000 +0000 > @@ -65,12 +65,8 @@ > gRecordSeparator = EvalString(options.recordSep) > gStringEncloser = EvalString(options.stringEncloser) > gEscapeCharacter = EvalString(options.escapeChar) > -while True: > > - # fetch a single row > - row = cursor.fetchone() > - if not row: > - break > +for row in cursor: > > # dump the row > outFile.write(gFieldSeparator.join([StringRep(v) for v in row])) > > We are using Python 2.4, and it's likely that the "while True" idiom (and > the roll-your-own CSV output) is to allow DumpCSV.py to run on older Python > versions. > > Please copy my email on responses (if any). I'm not subscribed to the tools > list, just the main cx_Oracle list > > Cheers! > -- > David Hancock | dha...@ar... > |