From: Oisin M. <oi...@en...> - 2003-08-27 00:11:05
|
Hi, Brad Bollenbach wrote: >On Tue, Aug 26, 2003 at 07:26:19PM +0100, Oisin Mulvihill wrote: >[snip Ian's comments] > > >>Hi, >> >>I said this already but I've used twisted and sqlobject successfully. I use >> >> > >Eh, it may *look* like you have. :) SQLObject is synchronous, Twisted >is asynchronous, there's no compatibility here. > >e.g. > >Person.select("hair_colour = 'blonde'") > > Ho-ho very funny. >In Twisted, every method call must return as fast as possible >(basically, instantly). In the above .select() is at the mercy of how >many blondes you have in your system. By extension, so is the rest of >your code; nothing else will get executed until that .select() comes >back. > >A deferred (in Twisted) doesn't solve this, because .select() doesn't >know how to be asynchronous anyway so the code will block no matter >what you try to do. > > Surely if it doesn't matter how long it takes to return in your system this isn't going to be a problem. In my situation the caller needs to know and will wait for an answer. I don't see the problem but I've only been dealing with database for about 6months or so, mainly small scale stuff which doesn't take long to return. >>twisted and sqlobject together in a call card top up system running on >>a linux server, which has been running without problems for the past few >>months. >> >> > >Interesting, but dangerous. Rest assurred if your system encounters >non-trivial load you'll need to rewrite it (by replacing SQLObject >with adbapi in Twisted.) > I presume this mean loosing the ORM and going to a low level of generating the sql queries. Are there other ORMs in which this wouldn't be a problem? Would it be possible to do an sqlobject reactor for twisted. I mean at a low level the database connections are socket connections. You could poll and read socket descriptors. This would then allow you to have the asynchronous behaviour. All the best, om |