login community faq

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 Mar 12 '12 at 17:26

Carlos%20Cosming's gravatar image

Carlos Cosming
11


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 Mar 12 '12 at 20:22

johns's gravatar image

johns ♦♦
340427

Just for curiosity: I guess this would be not a problem on a dedicated server, isn't it?

(Mar 13 '12 at 02:42) robertotra robertotra's gravatar image

That's currently not allowed on dedicated servers either, but we are considering changing that.

(Mar 13 '12 at 03:15) iliasr ♦♦ iliasr's gravatar image

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 Mar 13 '12 at 02:53

markusbarth's gravatar image

markusbarth
112

edited Mar 13 '12 at 03:13

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 Mar 14 '12 at 22:03

Carlos%20Cosming's gravatar image

Carlos Cosming
11

Your answer
If you have an answer to the above question, then use the form below. Otherwise, use the appropriate 'add new comment' button above to post your feedback.
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×19
×6
×2
×2
×1

Asked: Mar 12 '12 at 17:26

Seen: 1,008 times

Last updated: Mar 14 '12 at 22:03

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited