Skip to main content

A Cottontail DB gRPC client.

Project description

Cottontail DB gRPC Python Client

pypi Python package workflow

A Cottontail DB gRPC client for Python. Built with Cottontail DB Proto version 0.13.0. Comes with an interactive CLI for remote DB access.

Installation

Clone and install locally, or with pip install cottontaildb-client.

Usage

Running the interactive CLI is as easy as cottontaildb-client [--port PORT] host.

Example usage in scripts:

from cottontaildb_client import CottontailDBClient, Type, Literal, Null, column_def

with CottontailDBClient('localhost', 1865) as client:
    # Create schema
    client.create_schema('example_schema')
    # Define entity columns
    columns = [
        column_def('id', Type.STRING, nullable=False),
        column_def('value', Type.INTEGER, nullable=True)
    ]
    # Create entity
    client.create_entity('example_schema', 'example_entity', columns)
    # Insert entry
    entry = {'id': Literal(stringData='test_1'), 'value': Literal(intData=1)}
    client.insert('example_schema', 'example_entity', entry)
    # Insert batch
    columns = ['id', 'value']
    values = [
        [Literal(stringData='test_10'), Literal(intData=10)],
        [Literal(stringData='test_20'), Literal(intData=20)],
        [Literal(stringData='test_null'), Literal(nullData=Null())]
    ]
    client.insert_batch('example_schema', 'example_entity', columns, values)

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

cottontaildb-client-0.0.5.tar.gz (27.3 kB view hashes)

Uploaded Source

Built Distribution

cottontaildb_client-0.0.5-py3-none-any.whl (28.6 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