How to store smart-list rules in a relational database
===

The system I'm building has smart groups. By smart groups, I mean groups that update automatically based on these rules:

 1. Include all people that are associated with a given client.
 2. Include all people that are associated with a given client and have these occupations.
 3. Include a specific person (i.e., by ID)

Each smart groups can combine any number of these rules. So, for example, a specific smart list might have these specific rules:

 1. Include all people that are associated with client 1
 2. Include all people that are associated with client 5
 3. Include person 6
 4. Include all people associated with client 10, and who have occupations 2, 6, and 9

These rules are OR'ed together to form the group. I'm trying to think about how to best store this in the database given that, in addition to supporting these rules, I'd like to be able to add other rules in the future without too much pain.

The solution I have in mind is to have a separate model for each rule type. The model would have a method on it that returns a queryset that can be combined with other rules' querysets to, ultimately, come up with a list of people. The one downside of this that I can see is that each rule would have its own database table. Should I be concerned about this? Is there, perhaps, a better way to store this information?
