views:

42

answers:

0

I have a Pylons app that I'm using SqlAlchemy declarative models for. In order to make the code a bit cleaner I add a .query onto the SA Base and inherit all my models from that.

So in my app.model.meta I have

Base = declarative_base()
metadata = Base.metadata
Session = scoped_session(sessionmaker())

Base.query = Session.query_property(Query)

I think inherit this into app.model.mymodel and declare it as a child of meta.Base. This lets me write my queries as

mymodel.query.filter(mymodel.id == 3).all()

The trouble is that pylint is not seeing .query as a valid attribute of my models.

E:102:JobCounter.reset_count: Class 'JobCounter' has no 'query' member

Obviously this error is all over the place since it occurs on any model doing any query. I don't want to just skip the error because it might point out something down the road on non-orm classes, but I must be missing something for pylint to accept this.

Any hints?