`Resource.get` could accept a `namespace` parameter and do an internal lookup for client in a single query using something like this: `Resource.query.filter(Resource.name=name, Resource.client.namespace=namespace).first()`

IIRC, SQLAlchemy will generate a single SQL query with a join for this.