Forum Stats

  • 3,782,324 Users
  • 2,254,637 Discussions


How to - Run SQLPlus and script in Python ?

410266 Member Posts: 56
edited Jan 5, 2011 9:56AM in Python
I want to have Python run command like this (on Windows) - and wait for completion

"sqlplus.exe myname/[email protected] @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:'sqlplus.exe myname/[email protected] @C:\Temp\test.sql', shell=False)


  • 828729
    828729 Member Posts: 1
    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.
This discussion has been closed.