Re: Python embebbed with Oracle SQL*Plus

From: James T. Dennis <jadestar_at_idiom.com>
Date: Sun, 22 Jul 2001 06:53:34 GMT
Message-ID: <9hebu5$12lo$1_at_news.idiom.com>


[Quoted] [Quoted] In comp.lang.python Olav <olavb_at_yahoo.com> wrote:

> Some time ago I did some Oracle SQL*Plus on UNIX,
> and I was able to write quite powerful scripts
> embebbed in ksh (Korn Shell).
 

[Quoted] > Is something similar possible with Python?

[Quoted] 	I presume your ksh scripts were passing
	SQL code to an sql command (possibly in
	the form of "here" documents).

	For course you can build arbitrary commands
	in Python and invoke the system to execute
	them.  (sys.system()?).

> Also I have seen that that there is a special Perl
> version for Oracle. Is there something similar for
> Python (and would it be necessary to make a special
> Python for this?).

	The old "oraperl" was made obsolete (long ago)
	with the DBI interface and modules.  In Perl
	you have DBI which provides one abstract interface 
	to all SQL-like (and some non-SQL) databases
	(or things that you treat like databases in PERL)
	Then you have various DBDs which are called to 
	translate the DBI abstract functions/methods into
	the appropriate protocol/API for your database
	system.

> Generally, what is the best way to script Oracle with
> Python, and how does it compare to the two above?

	There is a similar set of classes/modules for
	Python (import db?).  I'll let someone else 
	speak to the current state of those.  (I've
	used one of them to access a PostgreSQL system)
	It seems that there were a few of them competing
	at that time; and there was some sort of 
	standardization and implementation effort going on
	(which might have happened in Python 2.x or 2.1.x
	--- I don't know).



> Thanks
> Olav
Received on Sun Jul 22 2001 - 08:53:34 CEST

Original text of this message