Re: [sqlalchemy] Re: using SQLA in distributed, concurrent, or asynchronous contexts?

2013-10-07 Thread Jonathan Vanasco
On Monday, October 7, 2013 8:27:34 PM UTC-4, Klauss wrote: > > 3- open a single request-scope session, and carry it through your async > tasks. I left that out, because it brings up the problem where your long-running session blocks the database (via transactions) or if you're in some 'auto

Re: [sqlalchemy] Re: using SQLA in distributed, concurrent, or asynchronous contexts?

2013-10-07 Thread Claudio Freire
On Mon, Oct 7, 2013 at 12:01 PM, Jonathan Vanasco wrote: > so the popular workaround(s) are to do both: > > 1- defer to thread (which most people would do anyways) > 2- open/close multiple sessions (which are cheap). basically , instead of > approaching a "task" in twisted as a single action of m

Re: [sqlalchemy] Re: using SQLA in distributed, concurrent, or asynchronous contexts?

2013-10-07 Thread Jonathan Vanasco
>From my understanding, this should be safe with Twisted: - SqlAlchemy "engine" operations, where you don't use the ORM and encapsulate every ansync "chunk" in a transaction, and within a thread - SqlAlchemy "orm" operations, where every async "chunk" is encapsulated in it's own session, and wit

Re: [sqlalchemy] Re: using SQLA in distributed, concurrent, or asynchronous contexts?

2013-10-05 Thread Iain Duncan
Thanks guys. Jonathan, that is, I think, what will be going on. So, I'm not quite clear from your comments, using SQLAlchemy with Twisted is practical now or not? Is it better to do it with Twisted than with Gevent? If you have the time to explain further about the persisting the session comment

[sqlalchemy] Re: using SQLA in distributed, concurrent, or asynchronous contexts?

2013-10-03 Thread Jonathan Vanasco
Also, a decent strategy to use is this: a) Your client does a lot of business logic in Pyramid. When you need to bill you hit an internal API or create a celery task b) You render a "waiting" page, and have ajax, or refresh, check to see if the internal API , or celery, is done processing c)

[sqlalchemy] Re: using SQLA in distributed, concurrent, or asynchronous contexts?

2013-10-03 Thread Jonathan Vanasco
So the "No SqlAlchemy with Twisted" approach is dated. > > I've been on the twisted list for a while, and recently asked it -- as i have a bit of stuff for the same project running in twisted as-well-as pyramid and-also celery. The current consensus is that it's a general no-go/bad-idea if you'r