WebFaction
Community site: login 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 12 Mar '12, 17:26

Carlos Cosming
111
accept rate: 0%


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.

permanent link

answered 12 Mar '12, 20:22

johns
5.4k412
accept rate: 23%

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.

permanent link

answered 13 Mar '12, 02:53

markusbarth
1139
accept rate: 0%

edited 13 Mar '12, 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

permanent link

answered 14 Mar '12, 22:03

Carlos Cosming
111
accept rate: 0%

Your answer
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

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×27
×9
×4
×2
×1

question asked: 12 Mar '12, 17:26

question was seen: 6,868 times

last updated: 14 Mar '12, 22:03

                              
WEBFACTION
REACH US
SUPPORT
LEGAL
© COPYRIGHT 2003-2021 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM