This discussion is archived
1 Reply Latest reply: Jan 5, 2011 6:56 AM by 828729 RSS

How to - Run SQLPlus and script in Python ?

410266 Newbie
Currently Being Moderated
I want to have Python run command like this (on Windows) - and wait for completion

"sqlplus.exe myname/mypw@proddb @C:\Temp\test.sql"

commands module does not seem to work,
and subprocess module just launches sqlplus.


How have you done this ?

thanks



edit: I added the "r" pre-pend and this works: subprocess.call(r'sqlplus.exe myname/mypw@proddb @C:\Temp\test.sql', shell=False)
  • 1. Re: How to - Run SQLPlus and script in Python ?
    828729 Newbie
    Currently Being Moderated
    I think this forum is really concerned with using Python with cx_Oracle module. Your question isn't really anything to do with Oracle directly, but more like how to call another executable synchronously from Python. You're not getting the best from Oracle any Python if you only use Python to call SQL*Plus - certainly it'll be awkward if you want to process any of the results from the SQL*Plus call.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points