google.appengine.api.datastore.Entity

A datastore entity.

Inherits From: expected_type

Includes read-only accessors for app id, kind, and primary key. Also provides dictionary-style access to properties.

this entity's kind

kind string

if provided, this entity's parent. Its key must be complete.

parent Entity or Key

if provided, this entity's name.

name string

if provided, this entity's id.

id integer

if provided, a sequence of property names that should not be indexed

by the built-in single property indices.

unindexed_properties list or tuple of strings
namespace string

if provided, overrides the default namespace_manager setting.

Methods

FromPb

View source

Static factory method. Returns the Entity representation of the given protocol buffer (datastore_pb.Entity).

Args
pb datastore_pb.Entity or str encoding of a datastore_pb.Entity
validate_reserved_properties deprecated
default_kind str, the kind to use if the pb has no key.

Returns
Entity the Entity representation of pb

ToPb

View source

Converts this Entity to its protocol buffer representation.

Returns
entity_pb2.Entity

ToXml

View source

Returns an XML representation of this entity.

Atom and gd:namespace properties are converted to XML according to their respective schemas. For more information, see:

http://www.atomenabled.org/developers/syndication/ https://developers.google.com/gdata/docs/1.0/elements

This is not optimized. It shouldn't be used anywhere near code that's performance-critical.

app

View source

Returns the name of the application that created this entity, a string or None if not set.

clear

D.clear() -> None. Remove all items from D.

copy

View source

The copy method is not supported.

entity_group

View source

Returns this entity's entity group as a Key.

Note that the returned Key will be incomplete if this is a a root entity and its key is incomplete.

fromkeys

Create a new dictionary with keys from iterable and values set to value.

get

Return the value for key if key is in the dictionary, else default.

is_projection

View source

Returns if this entity is a projection from full entity.

Projected entities:

  • may not contain all properties from the original entity;
  • only contain single values for lists;
  • may not contain values with the same type as the original entity.

is_saved

View source

Returns if this entity has been saved to the datastore.

items

D.items() -> a set-like object providing a view on D's items

key

View source

Returns this entity's primary key, a Key instance.

keys

D.keys() -> a set-like object providing a view on D's keys

kind

View source

Returns this entity's kind, a string.

namespace

View source

Returns the namespace of this entity, a string or None.

parent

View source

Returns this entity's parent, as a Key. If this entity has no parent, returns None.

pop

D.pop(k[,d]) -> v, remove specified key and return the corresponding value.

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

set_unindexed_properties

View source

setdefault

View source

If the property exists, returns its value. Otherwise sets it to value.

If the property name is the empty string or not a string, raises BadPropertyError. If the value is not a supported type, raises BadValueError.

unindexed_properties

View source

Returns this entity's unindexed properties, as a frozenset of strings.

update

View source

Updates this entity's properties from the values in other.

If any property name is the empty string or not a string, raises BadPropertyError. If any value is not a supported type, raises BadValueError.

values

D.values() -> an object providing a view on D's values

__contains__

True if the dictionary has the specified key, else False.

__eq__

Return self==value.

__ge__

Return self>=value.

__getitem__

x.getitem(y) <==> x[y]

__gt__

Return self>value.

__iter__

Implement iter(self).

__le__

Return self<=value.

__len__

Return len(self).

__lt__

Return self<value.

__ne__

Return self!=value.

__or__

Return self|value.

__ror__

Return value|self.