A simple client for submitting data to the DBpedia Databus
Project description
Databus Client Python
Install
python3 -m pip install databusclient
CLI Usage
databusclient --help
Usage: databusclient [OPTIONS] COMMAND [ARGS]...
Options:
--install-completion [bash|zsh|fish|powershell|pwsh]
Install completion for the specified shell.
--show-completion [bash|zsh|fish|powershell|pwsh]
Show completion for the specified shell, to
copy it or customize the installation.
--help Show this message and exit.
Commands:
deploy
downoad
Deploy command
databusclient deploy --help
Usage: databusclient deploy [OPTIONS] DISTRIBUTIONS...
Arguments:
DISTRIBUTIONS... distributions in the form of List[URL|CV|fileext|compression|sha256sum:contentlength] where URL is the
download URL and CV the key=value pairs (_ separted)
content variants of a distribution, fileExt and Compression can be set, if not they are inferred from the path [required]
Options:
--versionid TEXT target databus version/dataset identifier of the form <h
ttps://databus.dbpedia.org/$ACCOUNT/$GROUP/$ARTIFACT/$VE
RSION> [required]
--title TEXT dataset title [required]
--abstract TEXT dataset abstract max 200 chars [required]
--description TEXT dataset description [required]
--license TEXT license (see dalicc.net) [required]
--apikey TEXT apikey [required]
--help Show this message and exit.
Examples of using deploy command
databusclient deploy --versionid https://databus.dbpedia.org/user1/group1/artifact1/2022-05-18 --title title1 --abstract abstract1 --description description1 --license http://dalicc.net/licenselibrary/AdaptivePublicLicense10 --apikey MYSTERIOUS 'https://raw.githubusercontent.com/dbpedia/databus/master/server/app/api/swagger.yml|type=swagger'
databusclient deploy --versionid https://dev.databus.dbpedia.org/denis/group1/artifact1/2022-05-18 --title "Client Testing" --abstract "Testing the client...." --description "Testing the client...." --license http://dalicc.net/licenselibrary/AdaptivePublicLicense10 --apikey MYSTERIOUS 'https://raw.githubusercontent.com/dbpedia/databus/master/server/app/api/swagger.yml|type=swagger'
A few more notes for CLI usage:
- The content variants can be left out ONLY IF there is just one distribution
- For complete inferred: Just use the URL with
https://raw.githubusercontent.com/dbpedia/databus/master/server/app/api/swagger.yml - If other parameters are used, you need to leave them empty like
https://raw.githubusercontent.com/dbpedia/databus/master/server/app/api/swagger.yml||yml|7a751b6dd5eb8d73d97793c3c564c71ab7b565fa4ba619e4a8fd05a6f80ff653:367116
- For complete inferred: Just use the URL with
Module Usage
Step 1: Create lists of distributions for the dataset
from databusclient import create_distribution
# create a list
distributions = []
# minimal requirements
# compression and filetype will be inferred from the path
# this will trigger the download of the file to evaluate the shasum and content length
distributions.append(
create_distribution(url="https://raw.githubusercontent.com/dbpedia/databus/master/server/app/api/swagger.yml", cvs={"type": "swagger"})
)
# full parameters
# will just place parameters correctly, nothing will be downloaded or inferred
distributions.append(
create_distribution(
url="https://example.org/some/random/file.csv.bz2",
cvs={"type": "example", "realfile": "false"},
file_format="csv",
compression="bz2",
sha256_length_tuple=("7a751b6dd5eb8d73d97793c3c564c71ab7b565fa4ba619e4a8fd05a6f80ff653", 367116)
)
)
A few notes:
- The dict for content variants can be empty ONLY IF there is just one distribution
- There can be no compression if there is no file format
Step 2: Create dataset
from databusclient import createDataset
# minimal way
dataset = createDataset(
version_id="https://dev.databus.dbpedia.org/denis/group1/artifact1/2022-05-18",
title="Client Testing",
abstract="Testing the client....",
description="Testing the client....",
license_url="http://dalicc.net/licenselibrary/AdaptivePublicLicense10",
distributions=distributions,
)
# with group metadata
dataset = createDataset(
version_id="https://dev.databus.dbpedia.org/denis/group1/artifact1/2022-05-18",
title="Client Testing",
abstract="Testing the client....",
description="Testing the client....",
license_url="http://dalicc.net/licenselibrary/AdaptivePublicLicense10",
distributions=distributions,
group_title="Title of group1",
group_abstract="Abstract of group1",
group_description="Description of group1"
)
NOTE: To be used you need to set all group parameters, or it will be ignored
Step 3: Deploy to databus
from databusclient import deploy
# to deploy something you just need the dataset from the previous step and an APIO key
# API key can be found (or generated) at https://$$DATABUS_BASE$$/$$USER$$#settings
deploy(dataset, "mysterious api key")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
databusclient-0.10.tar.gz
(7.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file databusclient-0.10.tar.gz.
File metadata
- Download URL: databusclient-0.10.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.1 CPython/3.10.4 Linux/6.0.2-76060002-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c43739066513c363bec485b60d4b664977f602987ef1ee63c78958c05ea209a5
|
|
| MD5 |
c8558fb0ed90d812264f83d06e7a5c6d
|
|
| BLAKE2b-256 |
59bff30938d04bbe800a86a6798190c35f019ee5e4115b361d605e2bb20924ce
|
File details
Details for the file databusclient-0.10-py3-none-any.whl.
File metadata
- Download URL: databusclient-0.10-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.1 CPython/3.10.4 Linux/6.0.2-76060002-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
906c0ae5196611f86469c8b4ff05e013494e4c4cd316f90879a8bf4d36734d7f
|
|
| MD5 |
17ed3053823a37f1c71b4b2f6d091af2
|
|
| BLAKE2b-256 |
288e79f8fbaadc56818e90afdb725339f0087a5b474c5681febfeeba9dd2b6d4
|