Questions tagged [app-engine-ndb]

NDB is a better datastore API for the Google App Engine Python runtime. It provides an improved interface over ext.db, and includes support for parallel processing with coroutines.

NDB is a better datastore API for the Google App Engine Python runtime, and currently a standard component of the App Engine Python SDK and the Python runtime.

The NDB API provides persistent storage in a schemaless object datastore. It supports automatic caching, sophisticated queries, and atomic transactions. NDB is well-suited to storing structured data records.

Documentation.

Conversion guide from old db.

Original [deprecated] project.

1288 questions
62
votes
4 answers

Best practice to query large number of ndb entities from datastore

I have run into an interesting limit with the App Engine datastore. I am creating a handler to help us analyze some usage data on one of our production servers. To perform the analysis I need to query and summarize 10,000+ entities pulled from the…
Allen
  • 3,134
  • 5
  • 29
  • 49
23
votes
3 answers

Google App Engine NDB custom key id

When I create an object with ndb's method put it creates the key automatically of the type Key(kind, id) where id is a number. All over the documentation it shows that you can use a string for the key's id but I couldn't find out how to do this…
andrei
  • 877
  • 8
  • 18
20
votes
1 answer

Google-app-engine NDB

With the recent release of NDB, is there any reason to keep using the old datastore API? I'm working on an application that currently uses the old datastore API, and I have put quite some effort into caching objects in memcache. Am I correct in my…
Klaus Byskov Pedersen
  • 117,245
  • 29
  • 183
  • 222
20
votes
6 answers

Google App Engine error: NeedIndexError: no matching index found

I'm having trouble with Google's App engine indexes. When running my app via the GoogleAppEngineLauncher, the app is working fine. When deploying the app, I get the following error: NeedIndexError: no matching index found. The suggested index for…
18
votes
1 answer

How to delete all entities for NDB Model in Google App Engine for python?

I have a ndb model class: class Game(ndb.Model): gameID = ndb.IntegerProperty() gameName = ndb.StringProperty() Is there any way to quickly just delete all entities thats stored in the database for this class? Something like Game.deletAll()
bogen
  • 9,954
  • 9
  • 50
  • 89
17
votes
2 answers

Simple explanation of Google App Engine NDB Datastore

I'm creating a Google App Engine application (python) and I'm learning about the general framework. I've been looking at the tutorial and documentation for the NDB datastore, and I'm having some difficulty wrapping my head around the concepts. I…
jchitel
  • 2,999
  • 4
  • 36
  • 49
16
votes
3 answers

Most Efficient One-To-Many Relationships in Google App Engine Datastore?

Sorry if this question is too simple; I'm only entering 9th grade. I'm trying to learn about NoSQL database design. I want to design a Google Datastore model that minimizes the number of read/writes. Here is a toy example for a blog post and…
15
votes
2 answers

What is the correct way to get the previous page of results given an NDB cursor?

I'm working on providing an API via GAE that will allow users to page forwards and backwards through a set of entities. I've reviewed the section about cursors on the NDB Queries documentation page, which includes some sample code that describes how…
Greg
  • 33,450
  • 15
  • 93
  • 100
15
votes
2 answers

ndb to_dict method does not include object's key

I am leveraging ndb's to_dict method to convert an object's properties into a python dict. From everything I can tell, this method does not include the object's key or parent within the dict as per the documentation:…
Alan Ruth
  • 193
  • 1
  • 7
15
votes
2 answers

db.ReferenceProperty() vs ndb.KeyProperty in App Engine

ReferenceProperty was very helpful in handling references between two modules. Fox example: class UserProf(db.Model): name = db.StringProperty(required=True) class Team(db.Model): manager_name = db.ReferenceProperty(UserProf,…
rajpy
  • 2,436
  • 5
  • 29
  • 43
15
votes
2 answers

google app engine's ndb: get an entity's id

This looks simple, but I just didn't find how to get an entity's id from Google App Engine's ndb. class Message(ndb.Model): name: ndb.StringProperty() ... Create a message object: message = Message(id=someId) message.name =…
Randy Tang
  • 4,283
  • 12
  • 54
  • 112
15
votes
3 answers

ndb modelling one-to-many: merits of repeated KeyProperty vs foreign key

My question is about modelling one-to-many relations in ndb. I understand that this can be done in (at least) two different ways: with a repeated property or with a 'foreign key'. I have created a small example below. Basically we have an Article…
Emiel vl
  • 186
  • 2
  • 7
15
votes
1 answer

how to cleanly remove ndb properties

in my app i need to remove a few of my models properties. i checked out this link but the first issue is that the properties are on a polymodel and there is no way im going to switch to an expando for the time to remove the properties, im not even…
aschmid00
  • 7,038
  • 2
  • 47
  • 66
14
votes
2 answers

What are the speed comparisons of NDB vs DB (on High Replication Datastore)?

Taken from the Python NDB Overview: When the application reads an entity, that entity is automatically cached; this gives fast (and inexpensive) reads for frequently-read entities. ... The NDB function that writes the data (for example, put())…
wtr
  • 762
  • 8
  • 16
14
votes
2 answers

what's the difference between google.appengine.ext.ndb and gcloud.datastore?

ndb: (from google.appengine.ext import ndb) datastore: (from gcloud import datastore) What's the difference? I've seen both of them used, and hints they both save data to google datastore. Why are there two different implementations?
1
2 3
85 86