Mercurial > sqlpython
changeset 13:7c073794564a
holy cow, pull -f works even better
author | devlinjs@FA7CZA6N1254998.wrightpatterson.afmc.ds.af.mil |
---|---|
date | Tue, 18 Dec 2007 19:09:18 -0500 |
parents | 7d27bb74ba90 |
children | 1300a997d319 |
files | sqlpyPlus.py |
diffstat | 1 files changed, 7 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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"