now, I'm using it like this:

@defer.inlineCallbacks
    def jsonrpc_get(self, id):
        self.log.debug("get device with id %s" % id)
        device = yield deferToThread(self.devices.get, id)
        // then generate output from device, where device is ORM object

if devices.get method I use scoped_session. But I can't remove at the end 
of method get, because it return ORM object and if I remove sessoin then I 
wont have accecc to device fields.
I can close this session at the end of the jsonrpc_get:
session = object_session(device)
session.close()

but I cant remove it with
Session.remove()
because I already in an other thread.
In next request I will have the same session object(if twisted give out the 
same thread from threadpool)
Is it normal to close session and dont remove it?


On Thursday, February 13, 2014 10:02:54 AM UTC+4, Pavel Aborilov wrote:
>
> Hello!
> I'm working with SA from Twisted, and it's not so simple as I though. I 
> red some old topic in this group and didn't find any good solution.
> I just want to know if there are any approach at present?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to