Skip to content

Commit

Permalink
Upgrade/proto 0.16.6 (#23)
Browse files Browse the repository at this point in the history
* Prepare upgrade to proto 0.15.0

* Upgrade and fix tests for proto 0.16.6

* Add missing .pyi file

* Update README with new generation instructions

* Update version

* Update cottontaildb image version for tests
  • Loading branch information
Spiess authored Apr 29, 2024
1 parent e3bec41 commit 5f7239e
Show file tree
Hide file tree
Showing 8 changed files with 1,092 additions and 817 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
# Setup Cottontail DB service container
services:
cottontail:
image: vitrivr/cottontaildb:0.15.2
image: vitrivr/cottontaildb:0.16.6
ports:
- 1865:1865
options: -it
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ with CottontailDBClient('localhost', 1865) as client:

## Developing

To update the gRPC client, regenerate `cottontaildb_pb2.py` and `cottontaildb_pb2_grpc.py` from the proto definitions
file in the [Cottontail DB Proto](https://github.com/vitrivr/cottontaildb-proto) repository.
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](https://github.com/vitrivr/cottontaildb) repository.

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

```bash
# Get the latest version of the Cottontail DB proto (and download to cottontaildb_client directory)
wget https://github.com/vitrivr/cottontaildb-proto/raw/master/src/main/protobuf/cottontail.proto -P ./cottontaildb_client/
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=. --grpc_python_out=. ./cottontaildb_client/cottontail.proto
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
Expand Down
896 changes: 172 additions & 724 deletions cottontaildb_client/cottontail_pb2.py

Large diffs are not rendered by default.

759 changes: 759 additions & 0 deletions cottontaildb_client/cottontail_pb2.pyi

Large diffs are not rendered by default.

118 changes: 93 additions & 25 deletions cottontaildb_client/cottontail_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ def __init__(self, channel):
request_serializer=cottontaildb__client_dot_cottontail__pb2.EntityDetailsMessage.SerializeToString,
response_deserializer=cottontaildb__client_dot_cottontail__pb2.QueryResponseMessage.FromString,
)
self.EntityStatistics = channel.unary_unary(
'/org.vitrivr.cottontail.grpc.DDL/EntityStatistics',
request_serializer=cottontaildb__client_dot_cottontail__pb2.EntityDetailsMessage.SerializeToString,
response_deserializer=cottontaildb__client_dot_cottontail__pb2.QueryResponseMessage.FromString,
)
self.IndexDetails = channel.unary_unary(
'/org.vitrivr.cottontail.grpc.DDL/IndexDetails',
request_serializer=cottontaildb__client_dot_cottontail__pb2.IndexDetailsMessage.SerializeToString,
response_deserializer=cottontaildb__client_dot_cottontail__pb2.QueryResponseMessage.FromString,
)
self.CreateEntity = channel.unary_unary(
'/org.vitrivr.cottontail.grpc.DDL/CreateEntity',
request_serializer=cottontaildb__client_dot_cottontail__pb2.CreateEntityMessage.SerializeToString,
Expand All @@ -55,9 +65,9 @@ def __init__(self, channel):
request_serializer=cottontaildb__client_dot_cottontail__pb2.TruncateEntityMessage.SerializeToString,
response_deserializer=cottontaildb__client_dot_cottontail__pb2.QueryResponseMessage.FromString,
)
self.OptimizeEntity = channel.unary_unary(
'/org.vitrivr.cottontail.grpc.DDL/OptimizeEntity',
request_serializer=cottontaildb__client_dot_cottontail__pb2.OptimizeEntityMessage.SerializeToString,
self.AnalyzeEntity = channel.unary_unary(
'/org.vitrivr.cottontail.grpc.DDL/AnalyzeEntity',
request_serializer=cottontaildb__client_dot_cottontail__pb2.AnalyzeEntityMessage.SerializeToString,
response_deserializer=cottontaildb__client_dot_cottontail__pb2.QueryResponseMessage.FromString,
)
self.CreateIndex = channel.unary_unary(
Expand Down Expand Up @@ -115,6 +125,20 @@ def EntityDetails(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def EntityStatistics(self, request, context):
"""Returns details about the given column.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def IndexDetails(self, request, context):
"""Returns details about the given index.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def CreateEntity(self, request, context):
"""* Creates a new entity.
"""
Expand All @@ -136,7 +160,7 @@ def TruncateEntity(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def OptimizeEntity(self, request, context):
def AnalyzeEntity(self, request, context):
"""Optimizing and truncating entities.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
Expand Down Expand Up @@ -192,6 +216,16 @@ def add_DDLServicer_to_server(servicer, server):
request_deserializer=cottontaildb__client_dot_cottontail__pb2.EntityDetailsMessage.FromString,
response_serializer=cottontaildb__client_dot_cottontail__pb2.QueryResponseMessage.SerializeToString,
),
'EntityStatistics': grpc.unary_unary_rpc_method_handler(
servicer.EntityStatistics,
request_deserializer=cottontaildb__client_dot_cottontail__pb2.EntityDetailsMessage.FromString,
response_serializer=cottontaildb__client_dot_cottontail__pb2.QueryResponseMessage.SerializeToString,
),
'IndexDetails': grpc.unary_unary_rpc_method_handler(
servicer.IndexDetails,
request_deserializer=cottontaildb__client_dot_cottontail__pb2.IndexDetailsMessage.FromString,
response_serializer=cottontaildb__client_dot_cottontail__pb2.QueryResponseMessage.SerializeToString,
),
'CreateEntity': grpc.unary_unary_rpc_method_handler(
servicer.CreateEntity,
request_deserializer=cottontaildb__client_dot_cottontail__pb2.CreateEntityMessage.FromString,
Expand All @@ -207,9 +241,9 @@ def add_DDLServicer_to_server(servicer, server):
request_deserializer=cottontaildb__client_dot_cottontail__pb2.TruncateEntityMessage.FromString,
response_serializer=cottontaildb__client_dot_cottontail__pb2.QueryResponseMessage.SerializeToString,
),
'OptimizeEntity': grpc.unary_unary_rpc_method_handler(
servicer.OptimizeEntity,
request_deserializer=cottontaildb__client_dot_cottontail__pb2.OptimizeEntityMessage.FromString,
'AnalyzeEntity': grpc.unary_unary_rpc_method_handler(
servicer.AnalyzeEntity,
request_deserializer=cottontaildb__client_dot_cottontail__pb2.AnalyzeEntityMessage.FromString,
response_serializer=cottontaildb__client_dot_cottontail__pb2.QueryResponseMessage.SerializeToString,
),
'CreateIndex': grpc.unary_unary_rpc_method_handler(
Expand Down Expand Up @@ -322,6 +356,40 @@ def EntityDetails(request,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def EntityStatistics(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/org.vitrivr.cottontail.grpc.DDL/EntityStatistics',
cottontaildb__client_dot_cottontail__pb2.EntityDetailsMessage.SerializeToString,
cottontaildb__client_dot_cottontail__pb2.QueryResponseMessage.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def IndexDetails(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/org.vitrivr.cottontail.grpc.DDL/IndexDetails',
cottontaildb__client_dot_cottontail__pb2.IndexDetailsMessage.SerializeToString,
cottontaildb__client_dot_cottontail__pb2.QueryResponseMessage.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def CreateEntity(request,
target,
Expand Down Expand Up @@ -374,7 +442,7 @@ def TruncateEntity(request,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def OptimizeEntity(request,
def AnalyzeEntity(request,
target,
options=(),
channel_credentials=None,
Expand All @@ -384,8 +452,8 @@ def OptimizeEntity(request,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/org.vitrivr.cottontail.grpc.DDL/OptimizeEntity',
cottontaildb__client_dot_cottontail__pb2.OptimizeEntityMessage.SerializeToString,
return grpc.experimental.unary_unary(request, target, '/org.vitrivr.cottontail.grpc.DDL/AnalyzeEntity',
cottontaildb__client_dot_cottontail__pb2.AnalyzeEntityMessage.SerializeToString,
cottontaildb__client_dot_cottontail__pb2.QueryResponseMessage.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
Expand Down Expand Up @@ -761,22 +829,22 @@ def __init__(self, channel):
"""
self.Begin = channel.unary_unary(
'/org.vitrivr.cottontail.grpc.TXN/Begin',
request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
response_deserializer=cottontaildb__client_dot_cottontail__pb2.Metadata.FromString,
request_serializer=cottontaildb__client_dot_cottontail__pb2.BeginTransaction.SerializeToString,
response_deserializer=cottontaildb__client_dot_cottontail__pb2.ResponseMetadata.FromString,
)
self.Commit = channel.unary_unary(
'/org.vitrivr.cottontail.grpc.TXN/Commit',
request_serializer=cottontaildb__client_dot_cottontail__pb2.Metadata.SerializeToString,
request_serializer=cottontaildb__client_dot_cottontail__pb2.RequestMetadata.SerializeToString,
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
)
self.Rollback = channel.unary_unary(
'/org.vitrivr.cottontail.grpc.TXN/Rollback',
request_serializer=cottontaildb__client_dot_cottontail__pb2.Metadata.SerializeToString,
request_serializer=cottontaildb__client_dot_cottontail__pb2.RequestMetadata.SerializeToString,
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
)
self.Kill = channel.unary_unary(
'/org.vitrivr.cottontail.grpc.TXN/Kill',
request_serializer=cottontaildb__client_dot_cottontail__pb2.Metadata.SerializeToString,
request_serializer=cottontaildb__client_dot_cottontail__pb2.RequestMetadata.SerializeToString,
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
)
self.ListTransactions = channel.unary_stream(
Expand Down Expand Up @@ -843,22 +911,22 @@ def add_TXNServicer_to_server(servicer, server):
rpc_method_handlers = {
'Begin': grpc.unary_unary_rpc_method_handler(
servicer.Begin,
request_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
response_serializer=cottontaildb__client_dot_cottontail__pb2.Metadata.SerializeToString,
request_deserializer=cottontaildb__client_dot_cottontail__pb2.BeginTransaction.FromString,
response_serializer=cottontaildb__client_dot_cottontail__pb2.ResponseMetadata.SerializeToString,
),
'Commit': grpc.unary_unary_rpc_method_handler(
servicer.Commit,
request_deserializer=cottontaildb__client_dot_cottontail__pb2.Metadata.FromString,
request_deserializer=cottontaildb__client_dot_cottontail__pb2.RequestMetadata.FromString,
response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
),
'Rollback': grpc.unary_unary_rpc_method_handler(
servicer.Rollback,
request_deserializer=cottontaildb__client_dot_cottontail__pb2.Metadata.FromString,
request_deserializer=cottontaildb__client_dot_cottontail__pb2.RequestMetadata.FromString,
response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
),
'Kill': grpc.unary_unary_rpc_method_handler(
servicer.Kill,
request_deserializer=cottontaildb__client_dot_cottontail__pb2.Metadata.FromString,
request_deserializer=cottontaildb__client_dot_cottontail__pb2.RequestMetadata.FromString,
response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
),
'ListTransactions': grpc.unary_stream_rpc_method_handler(
Expand Down Expand Up @@ -895,8 +963,8 @@ def Begin(request,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/org.vitrivr.cottontail.grpc.TXN/Begin',
google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
cottontaildb__client_dot_cottontail__pb2.Metadata.FromString,
cottontaildb__client_dot_cottontail__pb2.BeginTransaction.SerializeToString,
cottontaildb__client_dot_cottontail__pb2.ResponseMetadata.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

Expand All @@ -912,7 +980,7 @@ def Commit(request,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/org.vitrivr.cottontail.grpc.TXN/Commit',
cottontaildb__client_dot_cottontail__pb2.Metadata.SerializeToString,
cottontaildb__client_dot_cottontail__pb2.RequestMetadata.SerializeToString,
google_dot_protobuf_dot_empty__pb2.Empty.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
Expand All @@ -929,7 +997,7 @@ def Rollback(request,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/org.vitrivr.cottontail.grpc.TXN/Rollback',
cottontaildb__client_dot_cottontail__pb2.Metadata.SerializeToString,
cottontaildb__client_dot_cottontail__pb2.RequestMetadata.SerializeToString,
google_dot_protobuf_dot_empty__pb2.Empty.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
Expand All @@ -946,7 +1014,7 @@ def Kill(request,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/org.vitrivr.cottontail.grpc.TXN/Kill',
cottontaildb__client_dot_cottontail__pb2.Metadata.SerializeToString,
cottontaildb__client_dot_cottontail__pb2.RequestMetadata.SerializeToString,
google_dot_protobuf_dot_empty__pb2.Empty.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
Expand Down
Loading

0 comments on commit 5f7239e

Please sign in to comment.