Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



Metadata Entities Python Reference

The model classes EntityGroup , Namespace , Kind , and Property represent the results of getting or querying metadata kinds. These classes are all defined in the package google.appengine.ext.db.metadata . See the page Metadata for more information and examples of their use.

  1. Helper Functions
  2. EntityGroup
  3. Namespace
  4. Kind
  5. Property

Helper Functions

The following helper functions are available for obtaining metadata information without issuing an explicit query or get:

get_entity_group_version ( entity_or_key )

Returns the version of the entity group containing entity_or_key . This version is guaranteed to increase on every change to the entity group. The version may increase even in the absence of user-visible changes to the entity group. May return None if the entity group was never written to. On non-HR datatores, this function returns None .

Arguments:

entity_or_key
a key or entity whose version you want.

get_namespaces ( start = None , end = None )

Returns a list of namespace names.

Arguments

start

If not None , return only namespace names greater than or equal to the specified value.

end

If not None , return only namespace names less than the specified value.

get_kinds ( start = None , end = None )

Returns a list of entity kind names.

Arguments

start

If not None , return only kind names greater than or equal to the specified value.

end

If not None , return only kind names less than the specified value.

get_properties_of_kind ( kind , start = None , end = None )

Returns a list of indexed property names for a specified kind. Unindexed properties are not included.

Arguments

kind

The kind whose property names are requested.

start

If not None , return only property names greater than or equal to the specified value.

end

If not None , return only property names less than the specified value.

get_representations_of_kind ( kind , start = None , end = None )

Returns a dictionary mapping each indexed property name for a specified kind to a list of its representations. Unindexed properties are not included.

Arguments

kind

The kind whose property representations are requested.

start

If not None , return only representations for properties whose names are greater than or equal to the specified value.

end

If not None , return only representations for properties whose names are less than the specified value.

The EntityGroup Class

Model for __entity_group__ metadata (available in HR datastore only).

This metadata contains a numeric __version__ property that is guaranteed to increase on every change to the entity group. The version may increase even in the absence of user-visible changes to the entity group. The __entity_group__ entity may not exist if the entity group was never written to.

Property

version
The version number

Class Method

key_for_entity ( entity_or_key )
Return the metadata key for the entity group containing entity_or_key . Use this key as the argument to get() the __entity_group__ metadata entity for the entity group containing entity_or_key .

Arguments:

entity_or_key
a key or entity whose __entity_group__ key you want.

The Namespace Class

Class Namespace represents a metadata entity of the special kind __namespace__ , returned as a result of a namespace query . The entity's key is the name of the namespace. (An exception is the default namespace designated by the empty string "" : since this is not a valid key name, the default namespace is represented by a key with numeric ID 1 instead.)

Property

Instances of class Namespace have the following property:

namespace_name

Returns the name of the namespace specified by this entity's key.

Class Methods

Class Namespace has the following class methods:

key_for_namespace ( namespace )

Returns the __namespace__ key for the specified namespace.

Argument

namespace

The namespace whose key is requested.

key_to_namespace ( key )

Returns the namespace specified by a given __namespace__ key.

Argument

key

The key whose name is requested.

The Kind Class

Class Kind represents a metadata entity of the special kind __kind__ , returned as a result of a kind query . The entity's key is the name of the entity kind.

Property

Instances of class Kind have the following property:

kind_name

Returns the kind name specified by this entity's key.

Class Methods

Class Kind has the following class methods:

key_for_kind ( kind )

Returns the __kind__ key for the specified kind.

Argument

kind

The kind whose key is requested.

key_to_kind ( key )

Returns the kind specified by a given __kind__ key.

Argument

key

The key whose kind is requested.

The Property Class

Class Property represents a metadata entity of the special kind __property__ , returned as a result of a property query . The entity representing property P of kind K is built as follows:

  • The entity's key has kind __property__ and key name P.
  • The parent entity's key has kind __kind__ and key name K.

Properties

Instances of class Property have the following properties:

kind_name

Returns the property name specified by this entity's key.

property_name

Returns the property name specified by this entity's key.

Class Methods

Class Property has the following class methods:

key_for_kind ( kind )

Returns the parent key for __property__ keys of the specified kind.

Argument

kind

The kind whose parent key is requested.

key_for_property ( kind , property )

Returns the __property__ key for the specified property and kind.

Arguments

kind

The kind whose key is requested.

property

The property whose key is requested.

key_to_kind ( key )

Returns the kind specified by a given __property__ key.

Argument

key

The key whose kind name is requested.

key_to_property ( key )

Returns the property specified by a given __property__ key, or None if the key specified only a kind.

Argument

key

The key whose property name is requested.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.