Commit e0898a20 authored by Vincent Rondot's avatar Vincent Rondot
Browse files

Add convenient script to load the schema

parent 0318d3c5
Pipeline #32232 failed with stages
in 19 minutes and 54 seconds
......@@ -67,3 +67,13 @@ curl \
}'
```
The `loadschema.sh` script is a convenient script to register all schemas (to be run from within this directory), and can be used the following way:
```bash
#set the following variable
BASE_URL=TBD
DATA_PARTITION=TBD
TOKEN=TBD
./loadSchema.sh $BASE_URL $DATA_PARTITION $TOKEN
```
#!/bin/bash
#This is a convenient script for loading all the schemas
set -e
if [ $# -ne 3 ]
then
echo "Usage ./loadSchema.sh $BASE_URL $DATA_PARTITION $TOKEN"
fi
BASE_URL=$1
DATA_PARTITION=$2
TOKEN=$3
echo "Loading Schemas on '$BASE_URL', for DataPartition '$DATA_PARTITION'"
schemaFiles=$(ls *.json)
for schemaFile in $schemaFiles
do
echo "loading $schemaFile: "
schema=$(sed "s/DATA_PARTITION_TAG/${DATA_PARTITION}/" ${schemaFile})
echo $schema | head -c 100
echo "..."
curl \
--location \
--request POST "$BASE_URL/api/storage/v2/schemas" \
--header "Content-Type: application/json" \
--header "data-partition-id: $DATA_PARTITION" \
--header "Authorization: Bearer $TOKEN" \
--data-raw "${schema}"
echo ""
echo "---"
done
echo "Done!"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment