i am doing a data migration and i am doing the code below in several places. it was migrated some what from some bash stuff so it works, but wondering if it's more efficient to be using the mysql module, thanks.
p1 = Popen(["echo", query], stdout=PIPE, close_fds=True)
p2 = Popen(["mysql", "--host=host", "--port=3999",
"-u", "user", "--password=foo", "--protocol=TCP"],
stdin=p1.stdout, stdout=PIPE, close_fds=True)
p1.stdout.close()
`
p1 = Popen(["echo", "show columns from %s" % (table)], stdout=PIPE,
close_fds=True)
p2 = Popen(["mysql", "--host=host", "--port=3999",
"-u", "user", "--password=foo", "--protocol=TCP"],
stdin=p1.stdout, stdout=PIPE, close_fds=True)
p3 = Popen(["awk", "{print $1}"], stdin=p2.stdout, stdout=PIPE,
close_fds=True)