proto-google-cloud-datastore-v1
raw JSON → 0.90.4 verified Mon Apr 27 auth: no python
Protobuf and gRPC generated code for the Google Cloud Datastore v1 API. This is a low-level library providing the proto definitions and gRPC stubs; most users should use the higher-level google-cloud-datastore instead. Current version: 0.90.4. Released irregularly alongside Google API updates.
pip install proto-google-cloud-datastore-v1 Common errors
error ModuleNotFoundError: No module named 'google.cloud.datastore_v1' ↓
cause Package not installed or wrong import path.
fix
Run 'pip install proto-google-cloud-datastore-v1' and use 'from google.cloud.datastore_v1.proto import ...'.
error AttributeError: module 'google.cloud.datastore_v1' has no attribute 'proto' ↓
cause Missing protobuf subpackage due to incomplete installation or version mismatch.
fix
Ensure proto-google-cloud-datastore-v1 is installed with its dependencies: 'pip install --upgrade proto-google-cloud-datastore-v1 googleapis-common-protos grpcio protobuf'.
error ImportError: cannot import name 'DatastoreStub' from 'google.cloud.datastore_v1.proto.datastore_pb2_grpc' ↓
cause Module name typo: 'datastore_pb2_grpc' has double 'r'? Actually correct name is 'datastore_pb2_grpc' (single 'r' after 'st'). Common misspelling.
fix
Correct import: 'from google.cloud.datastore_v1.proto.datastore_pb2_grpc import DatastoreStub'.
Warnings
deprecated This library is generated from googleapis and may be deprecated in favor of google-cloud-datastore (the high-level client). Use google-cloud-datastore for most use cases. ↓
fix pip install google-cloud-datastore and use google.cloud.datastore.Client.
breaking Import paths changed in version 0.90.x. Previously importable as from google.cloud.datastore.v1.proto.*, now flattened to google.cloud.datastore_v1.proto.*. ↓
fix Replace 'google.cloud.datastore.v1' with 'google.cloud.datastore_v1' in all imports.
gotcha The package name on PyPI is proto-google-cloud-datastore-v1 but the import namespace is google.cloud.datastore_v1.proto (note underscore and suffix). ↓
fix Use 'google.cloud.datastore_v1.proto' for imports, not 'proto.google.cloud.datastore.v1'.
Imports
- DatastoreStub wrong
from proto.google.cloud.datastore.v1 import DatastoreStubcorrectfrom google.cloud.datastore_v1.proto.datastore_pb2_grpc import DatastoreStub - LookupRequest wrong
from google.cloud.datastore.v1 import LookupRequestcorrectfrom google.cloud.datastore_v1.proto.datastore_pb2 import LookupRequest
Quickstart
import grpc
from google.cloud.datastore_v1.proto.datastore_pb2_grpc import DatastoreStub
from google.cloud.datastore_v1.proto.datastore_pb2 import LookupRequest
channel = grpc.insecure_channel('datastore.googleapis.com:443')
stub = DatastoreStub(channel)
request = LookupRequest(project_id='my-project')
# response = stub.Lookup(request)
print('Client created')