I am trying to use the subprocess call in Python to open a sqlcl command line and run a basic query.
from subprocess import call
import time
call(["./bin/sql", "test/test@delphix-test.va2.test.com:1521:vd4"])
time.sleep(5)
query = "select * from test where test like '%test%;'"
call([query])
When I run the python script above, the connection is immediately established and I see the sql welcome banners in my terminal. The query does not seem to run though, and I assume I am doing something wrong. I know my query is correct as I can run that exact same query when manually connecting using sqlcl in the terminal. The script for some reason does not call the query and I am not sure why.
Does anyone know what I am doing wrong? I suspect it might be because when sql establishes the connection the shell starts running a new process and 'call' won't work in that situation?
------------------------------
likith sunny
DevOps Engineer
Delphix Community Members
------------------------------