Client for Keboola Storage API
Project description
Python client for the Keboola Storage API
Client for using Keboola Connection Storage API. This API client provides client methods to get data from KBC and store data in KBC. The endpoints for working with buckets, tables and workspaces are covered.
Install
pip install kbcstorage
or
pip install git+https://github.com/keboola/sapi-python-client.git
Client Class Usage
from kbcstorage.client import Client
client = Client('https://connection.keboola.com', 'your-token')
# get table data into local file
client.tables.export_to_file(table_id='in.c-demo.some-table', path_name='/data/')
# save data
client.tables.create(name='some-table-2', bucket_id='in.c-demo', file_path='/data/some-table')
# list buckets
client.buckets.list()
# list bucket tables
client.buckets.list_tables('in.c-demo')
# get table info
client.tables.detail('in.c-demo.some-table')
Endpoint Classes Usage
from kbcstorage.tables import Tables
from kbcstorage.buckets import Buckets
tables = Tables('https://connection.keboola.com', 'your-token')
# get table data into local file
tables.export_to_file(table_id='in.c-demo.some-table', path_name='/data/')
# save data
tables.create(name='some-table-2', bucket_id='in.c-demo', file_path='/data/some-table')
# list buckets
buckets = Buckets('https://connection.keboola.com', 'your-token')
buckets.list()
# list bucket tables
buckets.list_tables('in.c-demo')
# get table info
tables.detail('in.c-demo.some-table')
Tests
Create .env
file according to the .env.template
file and run the tests with:
$ docker compose run --rm -e KBC_TEST_TOKEN -e KBC_TEST_API_URL sapi-python-client -m unittest discover
Contribution Guide
The client is far from supporting the entire API, all contributions are very welcome. New API endpoints should
be implemented in their own class extending Endpoint
. Naming conventions should follow existing naming conventions
or those of the API. If the method contains some processing of the request or
response, consult the corresponding PHP implementation for
reference. New code should be covered by tests.
Note that if you submit a PR from your own forked repository, the automated functional tests will fail.
This is expected for security reasons, please do send the PR anyway.
Either run the tests locally (set KBC_TEST_TOKEN
(your token to test project) and
KBC_TEST_API_URL
(https://connection.keboola.com) variables) or ask for access. In case, you need a
project for local testing, feel free to ask for one.
The recommended workflow for making a pull request is:
git clone https://github.com/keboola/sapi-python-client.git
git checkout master
git pull
git checkout -b my-new-feature
# work on branch my-new-feature
git push origin my-new-feature:my-new-feature
This will create a new branch which can be used to make a pull request for your new feature.
License
MIT licensed, see LICENSE file.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file kbcstorage-0.9.2.tar.gz
.
File metadata
- Download URL: kbcstorage-0.9.2.tar.gz
- Upload date:
- Size: 38.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2bee5a7ca0c22699158ac443c5eb0210cf1bd5423f12533b97e6e6a22f1b977 |
|
MD5 | 79954142d4dbcf67f48531cca55afcf4 |
|
BLAKE2b-256 | ed408863f3cb296d7e7ab276f80f3416e3dbba4d38dd1379c8683244135fcc0b |
File details
Details for the file kbcstorage-0.9.2-py3-none-any.whl
.
File metadata
- Download URL: kbcstorage-0.9.2-py3-none-any.whl
- Upload date:
- Size: 26.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5712b5c2f6e45b062669b63afc4e68b154c914d33984462c5bfc354fe73cb084 |
|
MD5 | 0f8b18ae473ce239eb2ca0360e8f3341 |
|
BLAKE2b-256 | 038278bcc0541e074d6a2fa7ee566e9247a423005a6a7923d48f737db376e0e2 |