Re: [cx-oracle-users] Help with fetchraw
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2005-05-17 16:00:30
|
On 5/17/05, Chris Dunscombe <cdu...@ya...> wrote: >=20 > --- Anthony Tuininga <ant...@gm...> wrote: >=20 > > On 5/17/05, Chris Dunscombe <cdu...@ya...> wrote: > > > > > > --- Anthony Tuininga <ant...@gm...> wrote: > > > > 2) I'm not sure exactly what you are intending with this so I can't > > > > see why the simple > > > > > > > > for row in cursor: > > > > process_the_row() > > > > > > > > isn't going to work or isn't desirable. Perhaps you could give more > > > > detail? Thanks. > > > > > > The "problem" with: > > > > > > for row in cursor: > > > process_the_row() > > > > > > is that process_the_row() is essentially: > > > > > > for col in row: > > > rowOut =3D rowOut.append(format_col(col)) > > > rowOutString =3D "".join(rowOut) > > > > > > which creates quite an overhead when the tables have lots of columns = (>40). > > > > You should be able to rewrite "process_the_row()" as the following if > > all you are intending to do is replace None with "" > > > > for row in cursor: > > rowOutString =3D "".join([v or "" for v in row]) > > > > if all you are fetching is strings. There is a flag for turning > > numbers into strings in all cases as well. If you need something more > > complicated than the above (multiple data types) then I'll need more > > information. :-) >=20 > There are multiple datatypes typically varchar,number,date and sometimes = raw and long. Ok. So what exactly does the process_row() method do? If you give the full body I might be able to suggest something that would work better. Or if you'd rather play with it on your own, that's fine too. :-) |