1) You should be able to do something like this without the need to
descend into fetchraw().
import cx_Oracle
fromConnection =3D cx_Oracle.Connection("user/pw@tns")
toConnection =3D cx_Oracle.Connection("user/pw@tns")
fromCursor =3D fromConnection.cursor()
fromCursor.arraysize =3D 250 # set as desired
toCursor =3D toConnection.cursor()
toCursor.arraysize =3D 250 # set as desired, same as fromCursor
fromCursor.execute("some query")
toCursor.setinputsizes() # set things up if nulls are allowed
while True:
data =3D fromCursor.fetchmany()
if not data:
break
toCursor.executemany("some insert statement", data)
toConnection.commit() # if desired
That should do it and should perform quite well. The fetchraw(),
bindvar.copy() and executemanyprepared() trio were created solely to
avoid the overhead of creating Python objects for the data. Its more
complicated than the above code but I can give that as an example as
well if you really want it.
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.
On 5/12/05, Chris Dunscombe <cdu...@ya...> wrote:
> I'm looking to use cursor.fetchraw to help improve performance in an app =
I'm writing. I've looked
> at CopyData from cx_OracleTools but I'm afraid I couldn't work it out.
> If possible I'd like a simple full example to show me the way. The contex=
t is:
>=20
> 1) Retrieve rows from source table and insert into a target table which h=
as exactly the same
> structure.
>=20
> 2) Retrieve rows from source table, add some column formatting and write =
out to a file.
>=20
> Thanks very much,
>=20
> Chris Dunscombe
>=20
> PS Thanks for all the input re my previous posting on Nulls and None. I'v=
e still got some thinking
> and work to do on which is best for performance and how best to cope with=
different datatypes,
> particularly Longs (what a pain they are!!)
>=20
> __________________________________
> Yahoo! Mail Mobile
> Take Yahoo! Mail with you! Check email on your mobile phone.
> http://mobile.yahoo.com/learn/mail
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_id=3D7393&alloc_id=3D16281&op=3Dclick
> _______________________________________________
> cx-oracle-users mailing list
> cx-...@li...
> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>
|