Looking to run the command: ssh user@some_host “echo ‘some_sql’ | /usr/bin/mysql -u some_args”
How would I do this using Popen?
p1 = sp.Popen(["ssh", "user@some_host", "echo \"%s\"" % sql], stdout=sp.PIPE)
p2 = sp.Popen(["/usr/bin/mysql", "-u some_args"], stdin=p1.stdout, stdout=sp.PIPE)
Returns “OSError: [Errno 2] No such file or directory” since it’s looking for /usr/bin/mysql on the local machine.
perhaps combining it all into a single command?