Take the 2-minute tour ×

Could someone please tell me how one can make table classes and 'dbsession()' created using sqlalchemy in pyramid available globally, so I can query those tables within my templates.


share|improve this question

1 Answer 1

Given you should query in viewsand not in templates you can do something like this:

from myproject import models

def my_view(request):
    return {'models': models}

and in template access DBSession and your model classes with models.DBSession and models.MyClass

share|improve this answer

Your Answer


