I'm trying to overload session for an application so that I can add a
filter to every query without having to manually enter it. I
understand that session is a method, but, I haven't quite figured out
what is required to add my filter.
I have the following:
engine = create_engine('mysql://user:passw...@localhost/database')
session = sessionmaker(bind=engine)
DBSession = session()
class clientSession(session):
def query(self, *entities, **kwargs):
#self._query_cls.filter('clients.client_id==1')
return self._query_cls(entities, self, **kwargs)
clients = cs.query(clients).limit(5).all()
print clients
What I would like to accomplish is have a class that I can call that
always issues .filter('clients.client_id==value') on a query and
update.
I've searched google at length, but, haven't stumbled across the
solution and am hoping someone can at least point me in the right
direction.
Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---