def get_options(): """ Return the options to be used in the script. """ parser = cx_OptionParser.OptionParser() parser.AddOption("--pipe-name", default="DbDebugger", metavar="NAME", prompt="Pipe name", help="use this pipe name for communication with the " "database") parser.AddOption(cx_OracleUtils.SchemaOption()) cx_LoggingOptions.AddOptions(parser) options = parser.Parse() cx_LoggingOptions.ProcessOptions(options) return options
parser.AddOption( "--dest-role", metavar="ROLE", help="enable this <role> [identified by <password>] in the target " "database immediately after connecting by calling " "dbms_session.set_role") cx_LoggingOptions.AddOptions(parser) parser.AddArgument("source", required=True, help="a select statement or the name of the table to query") parser.AddArgument( "destination", help="the name of a table or view to perform the insert and update " "statements against") options = parser.Parse() cx_LoggingOptions.ProcessOptions(options) # set up the source connection sourceConnection = cx_OracleUtils.Connect(options.sourceSchema, options.sourceRole) sourceCursor = sourceConnection.cursor() if options.arraySize: sourceCursor.arraysize = options.arraySize if options.maxLongSize: sourceCursor.setoutputsize(options.maxLongSize) # set up the destination connection destConnection = cx_OracleUtils.Connect(options.destSchema, options.destRole) cursor = destConnection.cursor() # determine query to execute