Re: [cx-oracle-users] executemanyprepared(...)
Brought to you by:
atuining
From: Anthony T. <an...@co...> - 2004-04-30 16:52:55
|
On Fri, 2004-04-30 at 10:41, Orr, Steve wrote: > I don't see a test case on the executemanyprepared() function. Can > someone give me some sample code to demonstrate how to use this? I didn't prepare a test case because it is not part of the "standard" API for databases. I suppose I should rectify that at some point, in particular if people are going to actually use it... :-) As for sample code, I have code that is available publicly at http://starship.python.net/crew/atuining Within the package "cx_OracleTools" there is a script CopyData.py which uses all of the "advanced" techniques that cx_Oracle exports -- most of that code is for setting things up. The main loop at the end of the script is what is probably of greater interest to you. In addition, the package "cx_PyOracleLib" which "cx_OracleTools" depends on has another script cx_ImportData.py which might be a little simpler to peruse. If neither of those are helpful, you can always ask me and I'll see if I can explain it further. > I need to develop a fast data insert routine for query result sets > coming from the MySQLdb python module. I'm thinking about iterating > through a MySQL result set (which is list of tuples), say 1,000 or > 10,000 rows at a time, followed by mass inserts of those rows into > Oracle committing every 1,000 or 10,000 rows. This is probably the best way. You can use the standard API to do all of this but I have noticed that there is a difference of 2 or even 3 to 1 using the advanced techniques. To put things in perspective, though, my machine was capable of inserting about 4,000 rows/second using the standard technique and about 10,000 rows/second using the advanced technique. For most people, 4,000 rows/second is probably adequate... :-) > Other suggestions? > > > TIA !!! > Steve Orr > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle 10g. > Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id149&alloc_id66&op=click > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users -- Anthony Tuininga an...@co... Computronix Distinctive Software. Real People. Suite 200, 10216 - 124 Street NW Edmonton, AB, Canada T5N 4A3 Phone: (780) 454-3700 Fax: (780) 454-3838 http://www.computronix.com |