The `google-cloud-datastore` library is the official Python client for Google Cloud Datastore, a highly scalable NoSQL document database service. It provides APIs to store, query, and manage entities. This client also supports Firestore in Datastore mode. The current version is 2.24.0, and it follows the rapid release cadence of the broader `google-cloud-python` monorepo.
pip install google-cloud-datastoreVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate a `Datastore` client, create an entity with a specific key, save it, and then query for entities of a given kind. Ensure your `GOOGLE_CLOUD_PROJECT` environment variable is set or replace `'your-project-id'` with your actual GCP Project ID, and that you have authentication configured (e.g., `GOOGLE_APPLICATION_CREDENTIALS`).
Ensure `GOOGLE_APPLICATION_CREDENTIALS` is set for local development, or use a service account with the `Datastore User` role (or equivalent) for deployed applications.
Always initialize `datastore.Client()` with the `project` argument or set the `GOOGLE_CLOUD_PROJECT` environment variable.
Review the Datastore documentation on indexes and ensure all necessary composite indexes for your queries are defined and deployed.
For strong consistency, structure your data to allow ancestor queries (all related entities share a common root key) or perform reads within a transaction.
Verify whether your project uses Datastore or Firestore Native mode and install the appropriate client library (`google-cloud-datastore` vs `google-cloud-firestore`).
Run `gcloud auth application-default login` in your terminal to set up Application Default Credentials, or explicitly set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the path of a service account key file.
Ensure the library is installed in your active Python environment: `pip install google-cloud-datastore`.
Verify that the correct service account or user is being used, and ensure it has the `Cloud Datastore User` role (or equivalent custom role) on the project. Also, confirm that the Datastore API is enabled in the Google Cloud Console for your project.
Either include the property used in the inequality filter in all `DistinctOn` or `OrderBy` clauses, or remove `DistinctOn`/`OrderBy` clauses if they conflict with the inequality filter.
Go to the Google Cloud Console, navigate to the Databases page (Datastore/Firestore in Datastore mode), and create or initialize the Datastore database, selecting a suitable location.
No dependency data recorded yet.