Hi Andy, On Mon, Jan 4, 2010 at 8:08 PM, Andy <[email protected]> wrote:
> I'm new to sharding and am a little stuck on how to implement the toy > problem below. Basically I have a many-to-one relationship between a > Company and Employees, and I want shards which are partitioned > according to company name. My naive approach is to replicate and > rename the tables. > > (1) Is there a better approach? > (2) How do I switch context effectively to use the correct > my request handlers? > Why do you want to shard your tables at all? -Nick Johnson > > Thanks! > Andy > > > # (from my models.py) > # # I start with these two models, then shard by company > # class Company(db.Model): > # name=db.StringProperty(required=True) > # > # class Employee(db.Model): > # lastname=db.StringProperty(required=True) > # company=db.ReferenceProperty(Company, > collection_name='employees') > > # Company 'Foo' and it's employees > class Company_Foo(db.Model): > name=db.StringProperty(required=True) > > class Employee_Foo(db.Model): > lastname=db.StringProperty(required=True) > company=db.ReferenceProperty(Company_Foo, > collection_name='employees') > > # company 'Bar' and it's employees > class Company_Bar(db.Model): > name=db.StringProperty(required=True) > > class Employee_Bar(db.Model): > lastname=db.StringProperty(required=True) > company=db.ReferenceProperty(Company_Bar, > collection_name='employees') > > > > # (from my handlers.py) > # other imports here > from models import * # potentially hundreds of model shards!? > > def MyHandler(webpp.RequestHandler): > def post(self): > company_id=get_from_request(self) > if company_id == 'Foo': > my_emp=Employee_Foo.gql(...) > else: > my_emp=Employee_Bar.gql(...) > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-appengine%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > > > > -- Nick Johnson, Developer Programs Engineer, App Engine 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 [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
