[cx-oracle-users] Re: Reading CLOB output
Brought to you by:
atuining
From: Anthony T. <an...@co...> - 2004-03-19 20:54:05
|
Sure, why not. :-) import cx_Oracle connection = cx_Oracle.connect("user/pw@tns") cursor = connection.cursor() clob = cursor.callfunc("dbms_metadata.get_ddl", cx_Oracle.CLOB, ("TABLE", "NODELINK")) print "Value is:", clob.read() Is that simple enough? :-) On Fri, 2004-03-19 at 13:03, Orr, Steve wrote: > I'm using the cool 9i dbms_metadata package from SQLPlus but can't > figure out how use it with cx_Oracle 4. Here's a clipping from a SQLPlus > session: > --------------------------------------------------------------------- > SQL> SELECT dbms_metadata.get_ddl('TABLE','NODELINK') from dual; > > CREATE TABLE "HYDRA"."NODELINK" > ( "ID" NUMBER, > "PARENTID" NUMBER, > "NODETEXT" VARCHAR2(252) > ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING > STORAGE(INITIAL 65536 NEXT 65536 MINEXTENTS 1 MAXEXTENTS 2147483645 > PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) > TABLESPACE "USERS" > --------------------------------------------------------------------- > > This returns the DDL for a database object as a CLOB. I've tried to use > the cx_Oracle lob.read() function in Python but can't seem to figure it > out. Can you provide some sample code on this? > > > TIA!! > Steve Orr -- 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 |