Cloud Datastore is a NoSQL document database built for automatic scaling, high performance, and ease of application development.
App Engine apps running in the Python 2 standard runtime can only use the NDB Client Library to interact with Cloud Datastore. The Google Cloud Client Library isn't available for Python 2 apps running in the App Engine standard environment.Using Datastore with App Engine
To use Cloud Datastore with App Engine:
If you haven't already done so, create a database.
If you're creating a new database, choose Cloud Firestore in Datastore mode. Cloud Firestore is the next major version of Cloud Datastore and a re-branding of the product. Datastore mode is recommended for databases that will primarily be used with App Engine.
You can use existing Cloud Datastore databases App Engine apps. These existing databases will be automatically upgraded to Cloud Firestore in Datastore mode.
In your app, declare Cloud Datastore as a dependency by adding
google-cloud-datastoreto your app'srequirements.txtfile.Use NDB to create, retrieve, and manage entities in your Cloud Datastore database.
Configuring indexes
Cloud Datastore uses indexes for every query your application makes. The indexes are updated whenever an entity changes, so the results can be returned quickly when the app makes a query.
Cloud Datastore automatically creates single-property indexes for use with
simple types of queries. For complex queries that include multiple properties,
you'll need to configure composite indexes in your app's index.yaml file.
The App Engine development server will update your index.yaml file
with the composite indexes needed to run your tests. Similarly, the
Cloud Datastore emulator can generate indexes
when you run tests.
You can also add the indexes to your app's
index.yaml file manually](
/appengine/docs/standard/python/config/indexref#automatic
) manually if you do not run local
tests or your tests do not include complex queries.
Setting database permissions
By default, your app has all the permissions required to read and write to Cloud Datastore and Cloud Firestore databases in your Google Cloud Platform project.
To manage these permissions, each App Engine app uses a default service account that gives full read and write access to Cloud Datastore and Cloud Firestore databases in the same project as the app. You can change the permissions of the default service account, but your app may lose access unless you assign an IAM role with the required permissions.
For information about allowing other users, apps, or projects to access a database, see Accessing your database.
Pricing, quotas, and limits
The Cloud Datastore offers a free quota with daily limits. Paid accounts offer unlimited storage, read, and write operations. More information is available on the Datastore Quotas page.


