2013-04-14 8 views
1

_message_fields_schema()을 사용하는 훌륭한 라이브러리에서 제공된 예제에서 예제 모델에는 정의 된 몇 개의 속성 참조 만 있습니다. 모든 속성과 ID를 가진 튜플을 채우는 가장 좋은 방법은 무엇입니까? 내가 SQL에서이 일을 한 경우_message_fields_schema 자동 채우기

이를 설명하는 가장 좋은 방법은 다음과 같습니다

select t.id, t.* from table t 

약간 인위적인을하지만 잘하면 당신은 아이디어를 얻을.

답변

2

라이브러리는이 작업을 지원하지 않지만 저자 (저자)에게는 제안 사항이 있습니다.

현재 모든 필드의 이름을 명시해야합니다. 예를 들어, simple get sample에서 :

from endpoints_proto_datastore.ndb import EndpointsModel 

class MyModel(EndpointsModel): 

    _message_fields_schema = ('id', 'attr1', 'attr2', 'created') 

    attr1 = ndb.StringProperty() 
    attr2 = ndb.StringProperty() 
    created = ndb.DateTimeProperty(auto_now_add=True) 

file a Feature Request 주시기 바랍니다.