So, basically what you say is that if I do something like:
def dataReceived(self, data):
reactor.callInThread(f, data)
and later you have:
def getData():
data = orm_session.query(Object).filter(data).all()
return data # eagerloaded, lazyloaded and put in any format you like
reactor.callFromThread(getData)
at the time of the query or when lazy-loading an attribute the reactor
would block?
And if so, why is that? I do not know the internals of the reactor nor
the ones of the ORM and I am interested why something like this won't work.
Thanks.
P.S: Sorry for the vaguely python pseudo-code, hope you got the idea.
Jean-Paul Calderone wrote:
On Tue, 17 Mar 2009 11:05:59 -0400, Ryan Lepidi <ryeg...@gmail.com>
wrote:
I have searched a bit, and it seems as though you can't use SQL
Alchemy with
twisted due to SA being thread unsafe. The only solution I found was
sAsync,
but this is old and unmaintained. What is everyone else doing for
database
access for a multiuser server? Is everyone really using raw sql
queries or
is there some easy solution that I'm missing?
I'm not even stuck on SQL Alchemy; if there is some other ORM that
works in
this case, I'd be willing to learn it.
I use Axiom (for Mantissa, a somewhat general-purpose application server,
for Quotient, a mail server based on it, for Imaginary, a text adventure
server based on it, for Blendix, a person aggregator based on it, for
Merit, a test results database, etc) most of the time. I know some other
people are using Storm.
Overall, I think that the way all existing ORMs work (including Axiom and
Storm) is hostile towards the typical Twisted program structure (or vice
versa, or both). So it's tough. The approach Axiom takes is to warn you
that any database operation you perform must complete quickly or your app
will suffer, and to restrict you to SQLite, so network issues can't hurt
you.
Jean-Paul
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
____________________________________________________________________________________
Be a professional. Click here to earn a psychology degree.
http://ads.lavabit.com/fc/BLSrjwr2XUejFQl52llZu1OHc75Kvdk24AO6XmzlqNlFiwPiYRenCdFpDfK/
____________________________________________________________________________________
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python