I have script to parse some data and save the data into Output.csv (Output.csv is located on server (/tmp) ) Then I want to import this Output.csv in to a MySQL existing table.
with open("/tmp/Output.csv", "w",0600) as text_file:
text_file.write(csv)
mydbs.connect()
mydbs.sqlcmd("""LOAD DATA LOCAL INFILE '/tmp/Output.csv' INTO TABLE my_table FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' ;""")
text_file.close()
os.remove("/tmp/Output.csv")
SQL query works in some way, for example if I change "my_table" to "my_tableasd" I get an error:
ProgrammingError: (1146, "Table 'dbs.my_tableasd' doesn't exist").
Also I can do any kind of Selects but this import simply does not work. I don't get any errors or warnings..nothing, but when I have a look into PHPmyAdmin there is no data imported.
I tried to import Output.csv through PhpMyAdmin and it works..
I also tried to set local-infile=1 to my.cnf ([mysql], [mysqld]) but nothing happened
Thank you very much