# HG changeset patch # User devlinjs@FA7CZA6N1254998.wrightpatterson.afmc.ds.af.mil # Date 1198022958 18000 # Node ID 7c073794564a06abd05f6e3edf408a993ec6365e # Parent 7d27bb74ba905c2e5c8f4cb940dcf97329fb13bc holy cow, pull -f works even better diff -r 7d27bb74ba90 -r 7c073794564a sqlpyPlus.py --- a/sqlpyPlus.py Tue Dec 18 18:53:46 2007 -0500 +++ b/sqlpyPlus.py Tue Dec 18 19:09:18 2007 -0500 @@ -664,7 +664,7 @@ pullflags = flagReader.FlagSet([flagReader.Flag('full')]) def do_pull(self, arg): - "Displays source code." + "Displays source code (pull -f to get dependent objects as well)." options, arg = self.pullflags.parse(arg) object_type, owner, object_name = self.resolve(arg.strip(self.terminator).upper()) @@ -672,13 +672,12 @@ print self.curs.callfunc('DBMS_METADATA.GET_DDL', cx_Oracle.CLOB, [object_type, object_name, owner]) if options.has_key('full'): - if object_type == 'TABLE': - dependent_types = ['TRIGGER'] - else: - dependent_types = [] - for dependent_type in dependent_types: - print self.curs.callfunc('DBMS_METADATA.GET_DEPENDENT_DDL', cx_Oracle.CLOB, - [dependent_type, object_name, owner]) + for dependent_type in ('OBJECT_GRANT', 'CONSTRAINT', 'TRIGGER'): + try: + print self.curs.callfunc('DBMS_METADATA.GET_DEPENDENT_DDL', cx_Oracle.CLOB, + [dependent_type, object_name, owner]) + except cx_Oracle.DatabaseError: + pass def do_describe(self, arg): "emulates SQL*Plus's DESCRIBE"