[pylons-devel] Re: peewee ORM

2015-07-20 Thread Jose Galvez
Thank you for your suggestions honestly that had been bothering me too. I removed the tween from the code completly an in its place I added a request method of the same name as the database proxy object which opens a connection and then registers a final_callback method to close the connection.

[pylons-devel] Re: peewee ORM

2015-07-20 Thread Jose Galvez
Thanks for the advise I'll look into that. I was trying to figure out how best to get a db connection and make sure its closes properly. putting it an a tween seemed convienent, but I get what your saying about the unnessary load for every request especiualy if a connection to the database is n

[pylons-devel] Re: peewee ORM

2015-07-20 Thread Jonathan Vanasco
I'm not sure what `request.peewee_dbs()[db].connect()` does, but I would probably recommend against this db setup pattern that you're using. By doing this in a tween, every request that pyramid handles will do a connect/disconnect to all the databases you defined. One of the more popular patte