[google-appengine] Re: Querying multiple tables in google app engine

2009-03-22 Thread xml2jsonp

From docs:
http://code.google.com/appengine/docs/python/datastore/entitiesandmodels.html

The name of the back-reference property defaults to modelname_set
(with the name of the model class in lowercase letters, and _set
added to the end), and can be adjusted using the collection_name
argument to the ReferenceProperty constructor.

--
Web Blue Screen of Death
http://pyoohtml.appspot.com/web-blue-screen-of-death

On Mar 22, 12:16 pm, arnie parvez...@rediffmail.com wrote:
 I have certain tables in datastore that are related to each other. say
 user table is related to Business table. How can we use a single query
 to fetch data from these tables at onece, say for a userid=2 we need
 the record from user table as well as from Business table with
 matching userid. I have seen that we cannot use sql like joins here in
 gql.
 So how can we construct a single query to get the desired records
 Thanks
 Arnie
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[google-appengine] Re: Querying multiple tables in google app engine

2009-03-22 Thread Tim Hoffman

Personally I think you are taking the wrong approach.

Think about you data model as a set of objects/entities and their
relationships and not as relation tables.

Not knowing what you exactly trying to do means the following example
is probably wrong,
ie I don't know if you have a one to one relationship between business
and user
but if you do use references

ie user.business is a referenproperty pointing to a business

You can fetch the object in either direction, business.user_set() will
return all users that refer to the business
and user.business will return the business.

Have a think in those terms, then you don't have to do joins.

You may have to in some case create an intermediate entity that
references multiple entities .

T


On Mar 22, 8:16 pm, arnie parvez...@rediffmail.com wrote:
 I have certain tables in datastore that are related to each other. say
 user table is related to Business table. How can we use a single query
 to fetch data from these tables at onece, say for a userid=2 we need
 the record from user table as well as from Business table with
 matching userid. I have seen that we cannot use sql like joins here in
 gql.
 So how can we construct a single query to get the desired records
 Thanks
 Arnie
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---