# Metadata Entities Python Reference - Google App Engine - Google Code

English ▼
Skip to page content Skip to main navigation
e.g. "templates" or "datastore"

# Metadata Entities Python Reference

The model classes `Namespace`, `Kind`, and `Property` define the special entity kinds returned as the results of metadata queries. These classes are all defined in the package `google.appengine.ext.db.metadata`. See the page Metadata Queries for more information and examples of their use.

- Helper Functions

- get_namespaces
- get_kinds
- get_properties_of_kind
- get_representations_of_kind

- `Namespace`

- Property

- namespace_name

- Class Methods

- key_for_namespace
- key_to_namespace

- `Kind`

- Property

- kind_name

- Class Methods

- key_for_kind
- key_to_kind

- `Property`

- Properties

- kind_name
- property_name

- Class Methods

- key_for_kind
- key_for_property
- key_to_kind
- key_to_property

## Helper Functions

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

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 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.