1 Reply Latest reply on Jan 5, 2011 2:56 PM by 828729

    How to - Run SQLPlus and script in Python ?

      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 ?


      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 ?
          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.