I'm trying to get a Python script to work that downloads a file and then loads the data into a mariadb. My best option seems to be using subprocess.run
, as I cannot update the Python version to a version that includes the new mariadb connector.
I've tried different options:
subprocess.run(["mysql", "-u" + mdb_usr, "-p" + mdb_pwd, "database", " < " + file.sql])
subprocess.run(["mysql", "-u" + mdb_usr, "-p" + mdb_pwd, "database < " + file.sql])
subprocess.run(["mysql -u" + mdb_usr + " -p" + mdb_pwd + "database < " + file.sql], shell = True)
But none of them seems to work.
Without the < file.sql
, I can get the script to work, but I can't seem to get the sql to execute. Can anyone point me in the right direction?