Skip to main content

The SirixDB Python SDK

Project description

sirix-python-client

The home of the SirixDB python client

This package is currently in alpha stage.

The python client supports both sync and async programs.

The api docs can be found here. The api docs can also be built locally with the following:

cd docs
make html

Some example code:

from pysirix import sirix_sync, DBType, Insert
from httpx import Client

client = Client(base_url="https://localhost:9443", verify="tests/resources/cert.pem")
sirix = sirix_sync("admin", "admin", client)

db = sirix.database("json-diff", DBType.JSON)
db.create()

resource = db.resource("json-resource")
resource.create(
    {
        "foo": ["bar", None, 2.33],
        "bar": {"hello": "world", "helloo": True},
        "baz": "hello",
        "tada": [{"foo": "bar"}, {"baz": False}, "boo", {}, []],
    }
)

resource.update(4, {"new": "stuff"}, insert=Insert.RIGHT)

Or with Async Support:

from pysirix import sirix_async, DBType, Insert
from httpx import AsyncClient
import asyncio


async def main():
    client = AsyncClient(base_url="https://localhost:9443", verify="tests/resources/cert.pem")
    sirix = await sirix_async("admin", "admin", client)

    db = sirix.database("json-diff", DBType.JSON)
    await db.create()

    resource = db.resource("json-resource")
    await resource.create(
        {
            "foo": ["bar", None, 2.33],
            "bar": {"hello": "world", "helloo": True},
            "baz": "hello",
            "tada": [{"foo": "bar"}, {"baz": False}, "boo", {}, []],
        }
    )

    await resource.update(4, {"new": "stuff"}, insert=Insert.RIGHT)

loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.run(main()))

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

pysirix-0.1.1.tar.gz (15.0 kB view hashes)

Uploaded Source

Built Distribution

pysirix-0.1.1-py3-none-any.whl (20.2 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