Howdy folks,
I'm seeking advice regarding database setup with Pylons.  Currently, I
have everything in a single database, but I'm pondering if using
multiple databases would mean better scalabilty and maintanability.

A quick run down: an organization can create their own site at a
subdomain they choose, and then create pages, blog postings, upload
files, photos, etc.  Users can belong to multiple organiztions with
different roles in each organization.

So far, I've been using a single database, which means all tables have
an `org_id` column so that I know what org the record belongs to.
This means on *each request I pick out the organization, based on
subdomain, in the base controller, then have the controller use that
org object to filter the records.

Something like this,
BaseController.__call__
   sub = routes_dict.get('sub_domain')
   org = model.Session.query(Org).filter_by(sub_domain=sub).one()
   environ['org'] = org
   ...

And now *every (nearly) action must use environ to filter the records
by org.
def index(self):
    org = request.environ.get('org', None)
    c.page = model.Session.query(model.Page).filter(org=org).one()
    render('/pages.mako')


This approach works ok I guess, but I reckon there is a better way.
Would using a multiple database setup be better/cleaner?  Like a
global `users` and `orgs`  db and then a database for each
organization's photos, blogs, files, pages etc?  If a multi db
approach is better, I've got some follow up questions :) because I've
not been able to figure some of it out.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to