How to get google appengine objects using their numeric identifier?

Is it possible to get an object from Google appengine using their numeric identifiers, and if so, how? I tried using:

key = Key.from_path ("ModelName", numeric value) m = ModelName.get (key)

but the generated key was not correct.

+3
source share
4 answers

,

key = Key.from_path (Application_ModelName, numeric_id)

, dict()

0

Other answers relate to old DB APIs. New applications will use the NDB datastore by default, which has a slightly different API. You can still make Model.get_by_id (id, parent) to get the object by identifier, but NDB also supports parameters for specifying the application and namespace. See the documentation for more details .

0
source

Source: https://habr.com/ru/post/1706576/


All Articles