Werner F. Bruhin wrote:
> Werner F. Bruhin wrote:
>   
>> I am having a problem with my app not closing correctly when I py2exe'd it.
>>
>> Trying to track it down but with not much look so far and as sqlalchemy 
>> is one of the big changes I did in this version of the app (i.e. moved 
>> from another ORM to sqlalchemy) I wonder if there are some things I have 
>> to watch out for.
>>
>> As I suspected SA I make sure that on close all my connections are 
>> closed and for good measure I also "del" my session and the engine.
>>
>> Is there anything else I should watch out for? 
>>
>> Is there some way I can check that I really closed all my connections?
>>
>> Is SA using threads?  If yes, do I need to do something special to 
>> ensure that they are all closed/finished?
>>   
>>     
> I resolved the issue by adding a "del self.ds" (which is my session)
>
> So, now I do something along these lines:
>
> self.engine = db.sa.create_engine(dburl, encoding='utf8', echo=False)
> self.Session = db.sao.sessionmaker(autoflush=True, transactional=True)
> self.Session.configure(bind=self.engine)
> self.ds = self.Session()
> ...
> self.ds.Close()
> del self.ds # if I don't do this app does not close
> del self.Session
> del self.engine
>
> I am using SA 0.4.3 and the engine is Firebird.
>
> Is this an indication that I am not closing something correctly, if yes 
> what could it be.
>
> BTW, I also tried "self.Session.close_all()"
>
> While the "del" solves my issue I am a bit nervous that I am using SA 
> somehow incorrectly.
>   
Had a discussion on this problem on the wxPython list with Andrea, he 
uses SA 0.4.6 with SQLite and does not see any issue when his py2exe'd 
application when it closes.

This confirms to me that either I am doing something wrong or the 
Firebird SQL backend in SA is for some reason not closing correctly.

Can anyone give me some hints on what I should look for/at to figure out 
what is causing the hang on a normal application shutdown.

Werner

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to