Hi Brendan,

On Thu, Jun 18, 2009 at 12:13 AM, Brendan <brendan.fosbe...@gmail.com>wrote:

>
> This is probably fairly simple to do but I'm fairly new to GAE and am
> having trouble with it.
>
> Say I run a query on an entity like so:
>
> query1=Client.all()
> query1.fetch(1)
> client=query1[0]
>
> selecting the first entry in the entity Client.


Using query1.get() is a neater way to do this - it returns the first result,
or None if there are no results.


>
> Then I iterate through the list of fields like so:
>
> for column in Client.fields():


I presume you mean Client.properties()?


>
> How can I access the data for that column in the row given by the
> query1 object? This is a fairly simple thing in Java with most
> databases but I'm using Python and GAE..


Try this:

for name, property in Client.properties.iteritems()
  value = property.__get__(client, Client)

-Nick Johnson


>
> I know I can access each element individually like this:
>
> first_name = client.first_name
>
> etc
>
> however I need to be able to dynamically reference the name of the
> field ..something like this
>
> col_name = "first_name"
> first_name_var = client.get(col_name)
>
> thanks
>
> >
>


-- 
Nick Johnson, App Engine Developer Programs Engineer
Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number:
368047

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to