I am using Flask-SQLAlchemy (but willing to drop to SQLAlchemy if needed) and trying to get figure out a way to get all values from a table where a combination of 4 columns are unique.

For example, I have this object Class - 

```py
class SearchRule(db.Model):
  id = db.Column(db.Integer, primary_key=True)
  type = db.Column(db.Text)
  location = db.Column(db.Text)
  owner = db.Column(db.Text)
  delegate = db.Column(db.Text)
  set_id = db.Column(db.Integer, db.ForeignKey('set.id'))

```

What I'd like to return is all `set_id` values where a combination of `type + location + owner + delegate` are unique.

Here is an example table -

```
id    type    location    owner    delegate    set_id
1     db      usa         matt     joe         5
2     db      usa         matt     joe         6
3     db      uk          jim      bob         9
4     db      uk          jim      bob         12

```

From this table I would like to return something like the following - 

```
[
  ('db', 'usa', 'matt', 'joe', [5, 6]), 
  ('db', 'uk, 'jim', 'bob', [9, 12])
]

Any help would be greatly appreciated!

```