See
http://groups.google.com/group/sqlalchemy/browse_thread/thread/aa9c753384532e6c/8d070ff7208494b1

The solution though I believe is just:


from sqlalchemy import create_engine
from sqlalchemy.pool import NullPool

to_engine = create_engine('sqlite:///%s' % temp_file_name, poolclass=NullPool)


Lance


On Mon, 2010-08-16 at 21:08 +0200, Jeroen Dierckx wrote:

> Hello all,
> 
> I am trying to export data from a MySQL database to a sqlite database
> using SqlAlchemy.
> I am using 2 engines for each database ( from and to ).
> This is the part that creates the sqlite engine:
> 
> to_engine   = create_engine(u'sqlite:///%s'%temp_file_name)
> to_meta_data = MetaData()
> to_meta_data.bind = to_engine
> 
> Then i move the tables from one engine to the other.
> I close the connections;
> to_connection.close()
> 
> 
> Finally i want to copy the sqlite file to its permanent location using
> shutil.move. But here it goes wrong; the file seems to be locked
> still:
> shutil.move(temp_file_name, self._filename)
> 
> I get this error (might not be verbatim):
> WindowsError: [Error 32] The process does not have access to the file
> because the file is being used by another process.
> 
> Can anyone give direction as to why the file might still be locked and
> how to avoid it?
> 
> Thanks in advance,
> Best regards,
> 
> Jeroen
> 


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

Reply via email to