A_Porcupine
A_Porcupine

Reputation: 1038

Using string to access datastore column

Looked through the documentation and can't work this out.

Is it possible to access the attribute of an entity retrieved from the datastore with a string in Python on GAE?

Something like employee.name but employee.<>

Upvotes: 1

Views: 43

Answers (1)

Paul Collingwood
Paul Collingwood

Reputation: 9116

You can do something like this, if I understand you correctly:

getattr(MyModel, attrib_name) 

which will retrieve the attribute attrib_name

Upvotes: 4

Related Questions