Demo application for KBC docker
9.7K
This is a working example of an application which is encapsulated in a Docker image and is integrated with KBC. Application functionality is simple, it splits long text columns from a single table into multiple rows and adds index number into a new column and writes the result into /data/out/tables/sliced.csv file.
git clone https://github.com/keboola/docker-demo-app.git
cd docker-demo-app
sudo docker build --no-cache -t keboola/docker-demo .
sudo docker run \
--volume=/home/ec2-user/data:/data \
--memory=64m \
--cpu-shares=1024 \
--rm \
keboola/docker-demo:latest
Note: --volume needs to be adjusted accordingly and has to lead to a data directory.
git clone https://github.com/keboola/docker-demo-app.git
cd docker-demo-app
composer install
phpunit
php ./src/run.php --data=/data
Where /data goes to your data folder.
Data directory must follow conventions defined in documentation.
The data folder must contain
data/config.jsondata/in/tablesMapped to /data/config.json
{
"storage": {
"input": {
"tables": {
"0": {
"source": "in.c-main.yourtable",
"destination": "source.csv"
}
}
},
"output": {
"tables": {
"0": {
"source": "sliced.csv",
"destination": "out.c-main.yourtable"
}
}
}
},
"parameters": {
"primary_key_column": "id",
"data_column": "text",
"string_length": 255
}
}
storage.input.tables[0].destination (required): source table fileparameters.primary_key_column (required): primary key column of the source tableparameters.data_column (required): column to be splitparameters.string_length (required): split lengthNote: attributes storage.input.tables[0].source and storage.output are not required for this script, but required for full functionality within Keboola Docker Bundle.
Mapped to /data/in/tables/source.csv
id,text,some_other_column
1,"Short text","Whatever"
2,"Long text Long text Long text","Something else"
Created in /data/out/tables/sliced.csv
id,text,row_number
1,"Short text",0
2,"Long text Long ",0
2,"text Long Text",1
Content type
Image
Digest
Size
169 MB
Last updated
almost 9 years ago
docker pull keboola/docker-demo-app:1.1.15