Skip to main content

No project description provided

Project description

Build Status

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

$ pip3 install git+https://github.com/keboola/sapi-python-client.git

or

$ git clone https://github.com/keboola/sapi-python-client.git && cd sapi-python-client
$ python setup.py install

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')

Docker image

Docker image with pre-installed library is also available, run it via:

docker run -i -t quay.io/keboola/sapi-python-client

Tests

$ git clone https://github.com/keboola/sapi-python-client.git && cd sapi-python-client
$ python setup.py test

or

$ 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 implemeneted 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 corresponing 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 limitation of Travis. 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

kbcstorage-0.5.0.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kbcstorage-0.5.0-py3-none-any.whl (33.7 kB view details)

Uploaded Python 3

File details

Details for the file kbcstorage-0.5.0.tar.gz.

File metadata

  • Download URL: kbcstorage-0.5.0.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for kbcstorage-0.5.0.tar.gz
Algorithm Hash digest
SHA256 fdce56a516838e084c1a4f11a10fb293b34765e717353a948bae871d585d4a67
MD5 fbb0cd80ff2a4f6f0d0662e6e0a27482
BLAKE2b-256 1ae9096f897f55dcb511bc1efb9f6fa44c0b6d8c760fd7d41b824f355aff5c32

See more details on using hashes here.

File details

Details for the file kbcstorage-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: kbcstorage-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 33.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for kbcstorage-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9af8c71cf1c0c8e3a49067a1b2d17e33b84b70def2e24488471f61ec9f9663d0
MD5 482cb6f7027a50737994bcae116bb224
BLAKE2b-256 306048be490b66cdf1638c83c1a9d8b654057fc97987927272d41079e320e835

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page