Wednesday, January 3, 2018

csv update app with spyre python

now I created csv update app with spyre. full code is here.

Preparation

set python vision and install dataspyre.
% python -V
Python 3.5.0
 
% pip install dataspyre

set directory tree as below. "test_data.csv" is the csv file to edit. number of columns have to be 5.

% tree
.
├── csv_update.py
├── data
│   ├── test_data.csv


% cat data/test_data.csv
data1,data2,data3,data4,data5
haha,hihi,huhu,hehe,hoho
gaga,gigi,gugu,gege,gogo
rara,riri,ruru,rere,roro

Execution


% python csv_update.py

Then, access to "http://127.0.0.1:9093"
input file name and push "get data" button.



input data and push "add data" button.




push "get data" button again to check added data.
backup data added under "data" directory in case.




% tree
.
├── csv_update.py
├── data
│   ├── test_data.csv
│   ├── test_data.csv_20180103173523
│   └── test_data.csv_20180103174330

% cat data/test_data.csv
data1,data2,data3,data4,data5
haha,hihi,huhu,hehe,hoho
gaga,gigi,gugu,gege,gogo
rara,riri,ruru,rere,roro
data1,data2,data3,data4,data5