Lynton Grice wrote:
> Hi there,
>
> I am using SQLAlchemy to build a custom based queue implementation.
>
> As part of the methods exposed I have a "deletequeue" that is meant to
> physically delete the SQLite database from the file system.
>
> But whenever I try delete it I get the following error:
>
> WindowsError: (32, 'The process cannot access the file because it is
> being used by another process'
>
> I have tried calling the DISPOSE method of the ENGINE object from
> SQLAlchemy but there is still some file handle holding on...
>
> All I have done is create the database (.db file), and now I want to
> delete it but no luck ;-(
>
> Any ideas how I can close any "handles" referencing that ".db" file
> for that SQLite database?
>

here is a test that passes for me, however even if I don't close the
connection or dispose the engine the file still allows deletion.   Your
first step is to ensure this program works on your platform.

from sqlalchemy import *

engine = create_engine("sqlite:///foo.db")

conn = engine.connect()
conn.execute("create table foo (bar string)")
conn.execute("insert into foo values('test')")
conn.close()
engine.dispose()

import os
os.remove('foo.db')












> Thanks for the help
>
> Lynton
>
> --
> 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.
>
>

-- 
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