Hello, I have a lot csv files wich are updated via cron jobs in specific times a long of day. In my workstation everything is fine, but in the webfaction server I got some problems, 'cause the sentence LOAD DATA INFILE can't work without file privileges. I know the more easiest way to deal with this scenario, is try to parse the css files to "INSERT INTO" statements, but I don't think so, 'cause that means replace a lot of pieces of code in all my bash scripts. Any suggestions? Thanks asked 12 Mar '12, 17:26 Carlos Cosming |
We do not allow LOAD DATA INFILE because it requires FILE read/write permission which we can not provide for security reasons. Your options are to convert them to INSERT or to use a mysql server compiled to execute as your system user. answered 12 Mar '12, 20:22 johns Just for curiosity: I guess this would be not a problem on a dedicated server, isn't it?
(13 Mar '12, 02:42)
robertotra
That's currently not allowed on dedicated servers either, but we are considering changing that.
(13 Mar '12, 03:15)
iliasr ♦♦
|
I don't know if you're familiar with python, but this can be acomplished a lot easier with a python skript, which will also help avoiding eventual proplems with uncorrect escapes, etc. (Importing csv directly into a database can be error prown). Have a look here: http://docs.python.org/library/csv.html and here: http://sqlobject.org/ The first is the csv parsing and processing module of python's standard library, the second one is an easy to use object relational wrapper. If you are familiar with django you can also use django's orm for the same purpose. Depending on the amount of columns this can be written within a couple of hours in python. IMHO, it is a lot easier to integrate python skripts into a workflow and they are a lot easier to maintain than shell skripts. Instead of piping your skript outputs into mysql-client you pipe it into a python skript, thus you don't have to change no a single line of your bash skripts. answered 13 Mar '12, 02:53 markusbarth |
Hi guys, Well the time is running out and a very fast solution is needed, so as markusbarth said, I had to write a python script (easy implementation) to convert the CSV files into INSERT statement. The essential idea always was there, but a confirmation by the community always helps. Thanks answered 14 Mar '12, 22:03 Carlos Cosming |