I have been executing Oracle SQL scripts from Python for a long time but never found a way to only suppress the banner and the connect and disconnect messages of SQL*Plus.
SQL*Plus itself is invoked with some code like this:
session = subprocess.Popen(
args=['sqlplus', '-S', '-L', username+'/'+password+'@'+server), "@{}".format(script)],
stdin=subprocess.PIPE,
stdout=sys.stdout,
stderr=subprocess.STDOUT,
)
try:
session.communicate(timeout=timeout)
except subprocess.TimeoutExpired:
session.kill()
session.communicate()
code = session.returncode
I'm aware that SQLPlus has the -S
silent option and this would suppress the banner, but when using the silent option SQLPlus also suppresses (even in the spool file) the echoing of commands.
Did someone find a way to just suppress the SQL*Plus banner and the connect and disconnect messages?
This seems to be a bug in SQL*Plus: Bug 17328625