Escolar Documentos
Profissional Documentos
Cultura Documentos
Property is the superclass for data model definitions. Query uses objects and methods to prepare queries.
Python SDK 1.1.9 Revision 1.0 03.10.09 Model.all() returns a query object.
Constructor
class Property(verbose_name=None, name=None, Constructor
Datastore google.appengine.ext.db
default=None, required=False, class Query(model_class)
A scalable storage and query engine.
validator=None, choices=None)
Instance Methods
Package Functions Class Attributes
filter(property_operator, value) self
get(key) Model instance data_type
order(property) self
You can also pass multiple keys and it will return multiple Model instances. Instance Methods ancestor(model instance|key) self
put(model_instance) Key object default_value() value
get() model instance or None
You can also pass multiple model instances and it will return multiple keys. validate(value) value or exception
fetch(limit, offset=0) list of model instances
delete(model_instance|key) empty(value) bool
count(limit=None) integer
run_in_transaction(function, *args, **kwargs) Type and Property Classes
Key represents a unique key for a datastore entity.
run_in_transaction_custom_retries(retries, function, Property Class Value Type Sort Order
*args, **kwargs) Constructor
StringProperty str Unicode (str is treated as ASCII)
unicode class Key(encoded=None)
Model is the superclass for data model definitions.
ByteStringProperty db.ByteString byte order Class Methods
Constructor
BooleanProperty bool False < True Key.from_path(*args, **kwds)
class Model(parent=None, key_name=None, **kwds)
The following example creates a key for an entity of kind Address with the numeric ID
IntegerProperty int Numeric
Class Methods 9876 whose parent is an entity of kind User with the named key ‘Boris’:
long
get(key) Key object k = Key.from_path(‘User’, ‘Boris’, ‘Address’, 9876)
FloatProperty float Numeric
get_by_id(id, parent=None) Model instance
DateTimeProperty datetime.datetime Chronological Instance Methods
You can also pass multiple ids and it will return multiple Model instances. DateProperty app() Application name (string)
get_by_key_name(key_name, parent=None) see above TimeProperty
kind() Kind (string)
ListProperty list If ascending, by least element; if
You can also pass multiple ids and it will return multiple Model instances. id() Numeric ID (int)
StringListProperty descending, by greatest element
get_or_insert(key_name, **kwds) see above ReferenceProperty db.Key By path elements (kind, ID or name) name() Entity name (string)
SelfReferenceProperty id_or_name() Numeric ID(int) or name (string)
all() Query object
UserProperty user.User By email address
gql(query_string, *args, **kwds) GQLQuery object has_id_or_name() bool
s = Story.gql(“WHERE title = :1”, “The Little Prince”) TextProperty db.Text (not orderable)
GQL is a SQL-like language for retrieving entities.
s = Story.gql(“WHERE title = :title”, title=”The Little Prince”)
CategoryProperty db.Category Unicode
Syntax
kind() Kind
LinkProperty db.Link Unicode WHERE <condition> [AND <condition> ...]
properties() dict
ORDER BY <property> [ASC | DESC] [,<property> [ASC | DESC]…]
EmailProperty db.Email Unicode
Instance Methods LIMIT [<offset>,]<count>
delete(key, seconds=0) error code The body content of the response. The App Engine image service lets your application manipulate im-
ages using the same infrastructure as Picasa Web.
delete_multi(keys, seconds=0, key_prefix=’’) bool
content_was_truncated
add(key, value, time=0, min_compress_len=0) bool
True if the allow_truncated parameter to fetch() was True and the
Image represents image data to be transformed.
add_multi(mapping, time=0, key_prefix=’’, list response exceeded the maximum response size. In this case, the content attribute
min_compress_len=0) contains the truncated response. Constructor
replace(key, value, time=0, min_compress_len=0) bool status_code class Image(image_data)