1

I want to output all attributes and values of the following GqlQuery:

benchmarks = db.GqlQuery("SELECT * FROM Benchmarks")

What's the easiest way to loop over the GqlQuery and output the names and values generically?

To be more precise, I DO NOT want to do this:

benchmarks = db.GqlQuery("SELECT * FROM Benchmarks")                           
        for b in benchmarks:
            self.response.out.write("<td>name:%s</td>" % b.name)
            self.response.out.write("<td>Id:%s</td>" % b.id)

But rather have all properties of a benchmark displayed, independent of their name.

Thanks for any advice!

mac
  • 42,153
  • 26
  • 121
  • 131
Philipp
  • 11
  • 1
  • 1
    possible duplicate of [Print all properties of an App Engine Model](http://stackoverflow.com/questions/6754994/print-all-properties-of-an-app-engine-model) – Wooble Jul 21 '11 at 15:40
  • Do you need to know all the properties that are in the datastore, or is it sufficient to loop over the properties in the current definition of your `Benchmarks` model? – Nick Johnson Jul 22 '11 at 00:33
  • @Wooble That depends if he just wants to iterate over model properties, or retrieve datastore column stats. – Nick Johnson Jul 22 '11 at 00:34
  • @Wobble: I would like to "dump" the datastore, basically output all instances with their model properties and their values. – Philipp Jul 27 '11 at 10:18

0 Answers0