Skip to main content

Cottontail DB gRPC Python Client

pypi Python package workflow

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

Versions are numbered such that the first two numbers correspond with those of the compatible Cottontail DB Proto.

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, 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()]
    ]
    client.insert_batch('example_schema', 'example_entity', columns, values)

Developing

To update the gRPC client, regenerate cottontaildb_pb2.py, cottontail_pb2.pyi, and cottontaildb_pb2_grpc.py from the proto definitions file in the Cottontail DB repository.

The following is an approximate guide on how to do so from a terminal:

# Get the latest version of the Cottontail DB proto (and download to cottontaildb_client directory)
wget https://github.com/vitrivr/cottontaildb/raw/master/cottontaildb-client/src/main/protobuf/cottontail.proto -P ./cottontaildb_client/
# Install necessary python packages
pip install grpcio grpcio-tools
# Generate the gRPC client
python -m grpc_tools.protoc -I. --python_out=. --pyi_out=. --grpc_python_out=. ./cottontaildb_client/cottontail.proto

It is important that the path to the cottontail.proto file reflects the location of the gRPC Python files, such that the imports can be generated correctly.

Metadata

Release files for cottontaildb-client 0.16.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cottontaildb-client 0.16.7
File Size Uploaded
cottontaildb_client-0.16.7.tar.gz 25.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cottontaildb-client 0.16.7
File Interpreter ABI Platform
cottontaildb_client-0.16.7-py3-none-any.whl Python 3 none any Details

Total release size: 52.2 kB

Release files / cottontaildb_client-0.16.7.tar.gz

Download URL cottontaildb_client-0.16.7.tar.gz
Size 25.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e3ca7862405760a3872c563780bdadf30a41132fbab2accddd4dedb3745771a8
BLAKE2b-256 checksum
How to use checksums
b2b9709d8ee768feb0c38de7e4858e0fa5ae084e4a399c17f82801e626987968
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / cottontaildb_client-0.16.7-py3-none-any.whl

Download URL cottontaildb_client-0.16.7-py3-none-any.whl
Size 26.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e855411272183ccded51b500e02d9f1fab752d1dfe665b7e25556cf8dd4ea1c9
BLAKE2b-256 checksum
How to use checksums
aedb97fd6e399050e2dfb7650644a215a2ad2231b41601dcd04b20557af0c366
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.16.7 This release

2 release files

0.16.6

2 release files

0.14.2

2 release files

0.14.1

2 release files

0.14.0

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page