Forum Stats

  • 3,769,556 Users
  • 2,252,976 Discussions
  • 7,875,083 Comments

Discussions

How to - Run SQLPlus and script in Python ?

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

thanks



edit: I added the "r" pre-pend and this works: subprocess.call(r'sqlplus.exe myname/[email protected] @C:\Temp\test.sql', shell=False)

Answers

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