Skip to main content

Official Skytable client library for Python

Project description

Skytable Python Client

PyPI - Version Static Badge GitHub Actions Workflow Status GitHub License

This is the official Python client driver for Skytable. The driver has been tested to work with Skytable 0.8.2 using the Skyhash/2 Protocol. The Python client driver provides first-class async support using asyncio and does not have any additional dependencies at the moment.

Example usage

Install the dependency:

pip install skytable-py

Use in your code:

import asyncio
from skytable_py import Config, Query


c = Config("root", "mypassword123456789")


async def main():
    db = None
    try:
        db = await c.connect()
        # init space
        assert (await db.run_simple_query(Query("create space apps"))).is_empty()
        # init model
        assert (await db.run_simple_query(Query("create model apps.auth(username: string, password: string)"))).is_empty()
        # insert our test row
        assert (await db.run_simple_query(Query("insert into apps.auth(?, ?)", "sayan", "mypassword"))).is_empty()
        # fetch data
        username, password = (await db.run_simple_query(Query("select * from apps.auth where username = ?", "sayan"))).row().columns
        # output
        print(f"username={username.string()}, password={password.string()}")
    except Exception as e:
        print(f"failed with error {e}")
    finally:
        if db:
            await db.close()

if __name__ == "__main__":
    asyncio.run(main())

License

This client library is distributed under the Apache-2.0 License.

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

skytable_py-0.1.3.tar.gz (11.7 kB view hashes)

Uploaded Source

Built Distribution

skytable_py-0.1.3-py3-none-any.whl (14.0 kB view hashes)

Uploaded Python 3

Supported by

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