Python reference implementation for uploading files to TriplyDB using the TUS resumable upload protocol.
- Python 3.8+
# Create virtual environment and install dependencies
./build.shThis creates a venv/ virtual environment and installs the required packages.
./upload.sh \
--file path/to/data.ttl \
--account your-account \
--dataset your-dataset \
--token YOUR_API_TOKENsource venv/bin/activate
python upload_file.py \
--file path/to/data.ttl \
--account your-account \
--dataset your-dataset \
--token YOUR_API_TOKEN./upload.sh \
--file path/to/data.nt \
--account your-account \
--dataset your-dataset \
--token YOUR_API_TOKEN \
--api-url http://api.triplydb.local \
--default-graph "http://example.org/my-graph" \
--overwrite-all| Parameter | Required | Description |
|---|---|---|
--file |
Yes | Path to the file to upload |
--account |
Yes | TriplyDB account name |
--dataset |
Yes | TriplyDB dataset name |
--token |
Yes | TriplyDB API token |
--api-url |
No | API URL (default: https://api.triplydb.com) |
--default-graph |
No | Default graph name for imported triples |
--overwrite-all |
No | Overwrite all existing graphs in the dataset |
--merge-graphs |
No | Merge data into existing graphs |
| Library | Version | Purpose |
|---|---|---|
| tuspy | >=1.0.0 | TUS protocol |
| requests | >=2.31.0 | HTTP client |
python/
├── requirements.txt
├── build.sh
├── upload.sh
├── README.md
└── upload_file.py