Python 2.7은 지원이 종료되었으며 2026년 1월 31일에
지원 중단됩니다. 지원 중단 후에는 조직에서 이전에 조직 정책을 사용하여 레거시 런타임의 배포를 다시 사용 설정한 경우에도 Python 2.7 애플리케이션을 배포할 수 없습니다. 기존 Python 2.7 애플리케이션은
지원 중단 날짜 이후에도 계속 실행되고 트래픽을 수신합니다.
지원되는 최신 Python 버전으로 마이그레이션하는 것이 좋습니다.
메타데이터 항목 Python 참조
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
참고: 새로운 애플리케이션을 빌드하는 개발자는 NDB 클라이언트 라이브러리를 사용하는 것이 좋습니다. NDB 클라이언트 라이브러리는 이 클라이언트 라이브러리와 비교할 때 Memcache API를 통한 자동 항목 캐싱과 같은 여러 이점이 있습니다. 현재 이전 DB 클라이언트 라이브러리를 사용 중인 경우 DB에서 NDB로의 마이그레이션 가이드를 참조하세요.
모델 클래스 EntityGroup
, Namespace
, Kind
, Property
는 메타데이터 종류를 가져오거나 쿼리한 결과를 나타냅니다.
이러한 클래스 모두 google.appengine.ext.db.metadata
패키지에 정의되어 있습니다. 해당 용도에 대한 자세한 내용 및 예시는 메타데이터 페이지를 참조하세요.
도우미 함수
다음 도우미 함수를 사용하면 명시적인 쿼리 또는 get을 실행하지 않고도 메타데이터 정보를 가져올 수 있습니다.
-
get_entity_group_version(entity_or_key)
-
entity_or_key
가 포함된 항목 그룹의 버전을 반환합니다. 이 버전은 항목 그룹이 변경될 때마다 증가합니다. 항목 그룹에 사용자가 확인할 수 있는 변경사항이 없어도 버전이 증가할 수 있습니다.
항목 그룹에 작성된 내용이 없는 경우 None
을 반환할 수 있습니다.
경고: 항목 그룹 메타데이터 동작이 달라졌습니다. 항목 그룹 버전이 사용자 업데이트로부터 독립적으로 증가할 수 있습니다. 이전에는 항목 그룹 버전이 사용자 업데이트 시에만 증가했습니다. 기존 동작을 유지하려면 항목 그룹 버전 해결 방법을 사용합니다.
인수:
- entity_or_key
- 원하는 버전의 키 또는 항목입니다.
-
get_namespaces(start=None, end=None)
-
네임스페이스 이름 목록을 반환합니다.
인수
-
시작
-
None
이 아니면 지정된 값보다 크거나 같은 네임스페이스 이름만 반환합니다.
-
종료
-
None
이 아니면 지정된 값보다 작은 네임스페이스 이름만 반환합니다.
-
get_kinds(start=None, end=None)
-
항목 종류 이름 목록을 반환합니다.
인수
-
시작
-
None
이 아니면 지정된 값보다 크거나 같은 종류 이름만 반환합니다.
-
종료
-
None
이 아니면 지정된 값보다 작은 종류 이름만 반환합니다.
-
get_properties_of_kind(kind, start=None, end=None)
-
지정된 종류에 대해 색인화된 속성 이름 목록을 반환합니다. 색인화되지 않은 속성은 포함되지 않습니다.
인수
-
kind
-
속성 이름이 요청된 종류입니다.
-
시작
-
None
이 아니면 지정된 값보다 크거나 같은 속성 이름만 반환합니다.
-
종료
-
None
이 아니면 지정된 값보다 작은 속성 이름만 반환합니다.
-
get_representations_of_kind(kind, start=None, end=None)
-
지정된 종류의 각 색인화된 속성 이름을 해당 표현 목록에 매핑하는 사전을 반환합니다. 색인화되지 않은 속성은 포함되지 않습니다.
인수
-
kind
-
속성 표현이 요청된 종류입니다.
-
시작
-
None
이 아니면 지정된 값보다 크거나 같은 이름의 속성에 대한 표현만 반환합니다.
-
종료
-
None
이 아니면 지정된 값보다 작은 이름의 속성 표현만 반환합니다.
EntityGroup 클래스
__entity_group__
메타데이터의 모델입니다(HR Datastore에서만 사용 가능).
이 메타데이터에는 항목 그룹이 변경될 때마다 증가하는 숫자 __version__
속성이 포함됩니다. 항목 그룹에 사용자가 확인할 수 있는 변경사항이 없어도 버전이 증가할 수 있습니다. 항목 그룹에 작성된 내용이 없는 경우 __entity_group__
항목이 없을 수 있습니다.
속성
- 버전
- 버전 번호입니다.
클래스 메서드
- key_for_entity(entity_or_key)
entity_or_key
가 포함된 항목 그룹의 메타데이터 키를 반환합니다. 이 키를 인수로 사용해 get()
을 실행하여 entity_or_key가 포함된 항목 그룹의 __entity_group__
메타데이터 항목을 가져올 수 있습니다.
인수:
- entity_or_key
- 원하는
__entity_group__
키의 항목 또는 키입니다.
Namespace 클래스
Namespace
클래스는 네임스페이스 쿼리의 결과로 반환된 특수한 종류 __namespace__
의 메타데이터 항목을 나타냅니다.
항목 키는 네임스페이스의 이름입니다. 단, 빈 문자열 ""
로 지정된 기본 네임스페이스는 예외입니다. 이는 유효한 키 이름이 아니기 때문에 기본 네임스페이스는 숫자 ID 1
인 키로 표시됩니다.
속성
Namespace
클래스의 인스턴스에는 다음 속성이 포함됩니다.
-
namespace_name
-
이 항목의 키로 지정된 네임스페이스의 이름을 반환합니다.
클래스 메서드
Namespace
클래스의 클래스 메서드는 다음과 같습니다.
-
key_for_namespace(네임스페이스)
-
지정된 네임스페이스의 __namespace__
키를 반환합니다.
인수
-
namespace
-
키가 요청된 네임스페이스입니다.
-
key_to_namespace(키)
-
제공된 __namespace__
키로 지정된 네임스페이스를 반환합니다.
인수
- key
-
이름이 요청된 키입니다.
Kind 클래스
Kind
클래스는 종류 쿼리의 결과로 반환된 특수한 종류 __kind__
의 메타데이터 항목을 나타냅니다.
항목 키는 항목 종류의 이름입니다.
속성
Kind
클래스의 인스턴스에는 다음 속성이 포함됩니다.
-
kind_name
-
이 항목의 키로 지정된 종류 이름을 반환합니다.
클래스 메서드
Kind
클래스의 클래스 메서드는 다음과 같습니다.
-
key_for_kind(종류)
-
지정된 종류의 __kind__
키를 반환합니다.
인수
-
kind
-
키가 요청된 종류입니다.
-
key_to_kind(키)
-
제공된 __kind__
키로 지정된 종류를 반환합니다.
인수
- key
-
종류가 요청된 키입니다.
Property 클래스
Property
클래스는 속성 쿼리의 결과로 반환된 특수한 종류 __property__
의 메타데이터 항목을 나타냅니다.
K 종류의 P 속성을 나타내는 항목은 다음과 같이 빌드됩니다.
- 항목 키에는
__property__
종류 및 키 이름 P가 포함됩니다.
- 상위 항목 키에는
__kind__
종류 및 키 이름 K가 포함됩니다.
속성
Property
클래스의 인스턴스에는 다음과 같은 속성이 있습니다.
-
kind_name
-
이 항목의 키로 지정된 종류 이름을 반환합니다.
-
property_name
-
이 항목의 키로 지정된 속성 이름을 반환합니다.
클래스 메서드
Property
클래스의 클래스 메서드는 다음과 같습니다.
-
key_for_kind(종류)
-
지정된 종류의 __property__
키에 대한 상위 키를 반환합니다.
인수
-
kind
-
상위 키가 요청된 종류입니다.
-
key_for_property(종류, 속성)
-
지정된 속성 및 종류의 __property__
키를 반환합니다.
인수
-
kind
-
키가 요청된 종류입니다.
-
property
-
키가 요청된 속성입니다.
-
key_to_kind(키)
-
제공된 __property__
키로 지정된 종류를 반환합니다.
인수
- key
-
종류 이름이 요청된 키입니다.
-
key_to_property(키)
-
제공된 __property__
키로 지정된 속성을 반환하거나 키에 종류만 지정된 경우 None
을 반환합니다.
인수
- key
-
속성 이름이 요청된 키입니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-09-04(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eDevelopers should use the NDB Client Library for new applications due to its advantages, such as automatic entity caching, over the older DB Client Library.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egoogle.appengine.ext.db.metadata\u003c/code\u003e package contains model classes like EntityGroup, Namespace, Kind, and Property, which represent the results of metadata queries.\u003c/p\u003e\n"],["\u003cp\u003eHelper functions are available to get metadata without explicit queries, including \u003ccode\u003eget_entity_group_version\u003c/code\u003e, \u003ccode\u003eget_namespaces\u003c/code\u003e, \u003ccode\u003eget_kinds\u003c/code\u003e, \u003ccode\u003eget_properties_of_kind\u003c/code\u003e, and \u003ccode\u003eget_representations_of_kind\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eget_entity_group_version\u003c/code\u003e function returns the version of an entity group, which now may increase even without user updates, a change from its previous behavior.\u003c/p\u003e\n"],["\u003cp\u003eFunctions such as \u003ccode\u003eget_namespaces\u003c/code\u003e, \u003ccode\u003eget_kinds\u003c/code\u003e, \u003ccode\u003eget_properties_of_kind\u003c/code\u003e, and \u003ccode\u003eget_representations_of_kind\u003c/code\u003e allow to filter their results based on start and end values provided.\u003c/p\u003e\n"]]],[],null,["# Metadata Entities Python Reference\n\n**Note:**\nDevelopers building new applications are **strongly encouraged** to use the\n[NDB Client Library](/appengine/docs/legacy/standard/python/ndb), which has several benefits\ncompared to this client library, such as automatic entity caching via the Memcache\nAPI. If you are currently using the older DB Client Library, read the\n[DB to NDB Migration Guide](/appengine/docs/legacy/standard/python/ndb/db_to_ndb)\n\nThe model classes\n[EntityGroup](#EntityGroup),\n[Namespace](#The_Namespace_Class),\n[Kind](#The_Kind_Class),\nand\n[Property](#The_Property_Class)\nrepresent the results of getting or querying metadata kinds.\nThese classes are all defined in the package\n`google.appengine.ext.db.metadata`. See the page\n[Metadata](/appengine/docs/legacy/standard/python/datastore/metadataqueries)\nfor more information and examples of their use.\n\nHelper Functions\n----------------\n\nThe following helper functions are available for obtaining metadata\ninformation without issuing an explicit query or get:\n\n\nget_entity_group_version(entity_or_key)\n\n: Returns the version of the entity group containing\n `entity_or_key`. This\n version is guaranteed to increase on every change to the entity\n group. The version may increase even in the absence of user-visible\n changes to the entity group.\n May return `None` if the entity group was\n never written to.\n\n **Warning** : The behavior of entity group metadata is now different. The entity\n group version can increase independently of user updates. Previously, the entity\n group version increased only on user update. To maintain legacy behavior, use the\n [entity group version workaround](https://support.google.com/cloud/answer/9133787#zippy=python-db).\n\n **Arguments:**\n\n entity_or_key\n : a key or entity whose version you want.\n\n\nget_namespaces(start=None, end=None)\n\n: Returns a list of namespace names.\n\n Arguments\n\n\n start\n\n : If not `None`, return only namespace names greater than or equal to the specified value.\n\n\n end\n\n : If not `None`, return only namespace names less than the specified value.\n\n\nget_kinds(start=None, end=None)\n\n: Returns a list of entity kind names.\n\n Arguments\n\n\n start\n\n : If not `None`, return only kind names greater than or equal to the specified value.\n\n\n end\n\n : If not `None`, return only kind names less than the specified value.\n\n\nget_properties_of_kind(kind, start=None, end=None)\n\n: Returns a list of indexed property names for a specified kind. Unindexed properties are not included.\n\n Arguments\n\n\n kind\n\n : The kind whose property names are requested.\n\n\n start\n\n : If not `None`, return only property names greater than or equal to the specified value.\n\n\n end\n\n : If not `None`, return only property names less than the specified value.\n\n\nget_representations_of_kind(kind, start=None, end=None)\n\n: Returns a dictionary mapping each indexed property name for a specified kind to a list of its representations. Unindexed properties are not included.\n\n Arguments\n\n\n kind\n\n : The kind whose property representations are requested.\n\n\n start\n\n : If not `None`, return only representations for properties whose names are greater than or equal to the specified value.\n\n\n end\n\n : If not `None`, return only representations for properties whose names are less than the specified value."]]