NDB 中繼資料屬性

此 API 屬於 google.appengine.ext.ndb.metadata 模組,通常需透過 from google.appengine.ext.ndb import metadata 使用。

函式

get_entity_group_version(key)
Return the version of the entity group containing key. 每次變更實體群組,這個版本一定會增加。即使實體 群組出現使用者看不見的變化, 版本數字也有可能增加。如果實體群組從未寫入,可能會傳回 None

警告:實體群組中繼資料的行為現在已有不同。實體群組版本數字增加可能跟使用者更新無關。在此之前,實體群組的版本數字只會因為使用者更新而增加。如要延續舊版行為,請採取實體群組版本因應措施

引數

key
實體群組的金鑰。
get_namespaces(start=None, end=None)
傳回命名空間名稱清單。

引數

start
請勿傳回此命名空間名稱之前的名稱 (依字母順序)。
end
Don't return namespace names after this in alphabetical order.
get_kinds(start=None, end=None):
傳回目前命名空間中的種類名稱清單。

引數

start
請勿在此之前依字母順序傳回種類名稱。
end
Don't return kind names after this in alphabetical order.
get_properties_of_kind(kind, start=None, end=None):
傳回目前命名空間中指定 kind 名稱的屬性名稱清單。

引數

kind
要列出的屬性種類。
start
請勿傳回此時間點之前的屬性名稱 (依字母順序)。
end
Don't return property names after this in alphabetical order.
get_representations_of_kind(kind, start=None, end=None)
將指定種類名稱的 dict 對應屬性名稱傳回至「STRING」、「BOOLEAN」或「INT64」之類的表示名稱清單。dict只會在目前的命名空間中尋找。 如需這些類型的完整清單,請參閱表示類型
傳回指定 kind 名稱的屬性名稱清單。

引數

kind
要列出的屬性種類。
start
請勿傳回此時間點之前的屬性名稱 (依字母順序)。
end
Don't return property names after this in alphabetical order.

表示法類型

屬性類別 表示法
StringProperty STRING
BooleanProperty BOOLEAN
IntegerProperty INT64
FloatProperty DOUBLE
DateTimeProperty
DateProperty
TimeProperty
INT64
UserProperty USER
BlobProperty STRING
BlobKeyProperty STRING
TextProperty STRING
GeoPtProperty POINT
GenericProperty (視儲存的值而定)。
ComputedProperty (視儲存的值而定)。
JsonProperty STRING
PickleProperty STRING
StructuredProperty (取得表示類型時,系統不會傳回 StructuredProperty 屬性。而是顯示與屬性類型對應的子屬性值。)
LocalStructuredProperty STRING
KeyProperty REFERENCE