Re: [sqlalchemy] Session autoflush when using history_meta (examples/versioned_history)

2016-09-04 Thread Simon King
> On 3 Sep 2016, at 01:36, HP3 wrote: > > Thank you Mike, > > I will strongly consider creating a PR for an alternative solution. > > I would need to dig into the library to learn the basics of sqlalchemy > architecture though. So far, I have only used 0.9.x and

[sqlalchemy] Re: Best use of engine_from_config

2016-09-04 Thread Jonathan Vanasco
You're doing it wrong, but it's not too hard to correct - it will mostly be shifting your existing code-blocks around as-is. Check out the current version of Pyramid's scaffold for SqlAlchemy (I think the template change happened in Pyramid 1.6) , which uses a more streamlined approach that

[sqlalchemy] Re: Best use of engine_from_config

2016-09-04 Thread Andrew Martin
Also, do be clear, what I have works. I'm passing the request object to the model and then creating the engine based on the request. It works, but I have a nagging feeling that this is not good and definitely not best. On Sunday, September 4, 2016 at 10:39:55 AM UTC-4, Andrew Martin wrote: > >

Re: [sqlalchemy] Best use of engine_from_config

2016-09-04 Thread Andrew Martin
That’s a really interesting approach, and I think I might try it. My concern here is whether I’m using things in the appropriate way. I think I’m failing to understand something about the way sqlalchemy works, and that’s the reason I’m asking this. For myself and for posterity. :) -andrew >

Re: [sqlalchemy] Best use of engine_from_config

2016-09-04 Thread Michał Dobrzański
For Pyramid application I cache engines in global variable under connection string keys. I cache engines when they're created. This way each time I need to use the engine I reach to that dictionary instead of creating it with each request. On Sun, Sep 4, 2016 at 4:39 PM, Andrew Martin

[sqlalchemy] Best use of engine_from_config

2016-09-04 Thread Andrew Martin
I have a question about using creating engines along with pretty much any python web framework, but I'm specifically working with Pyramid. For obvious reasons. :) The sqlalchemy docs state this: "The typical usage of create_engine()