HI there,

I tried your example on Windows and it works 100%...

I think it must have something to do with the way I am opening / using
the connection

db = create_engine(db_conn, echo=False, poolclass=StaticPool)
metadata = MetaData(db)
queue = Table(queueName, metadata,
       Column('IDX', Integer, primary_key=True, autoincrement =
True ),
       Column('ID', String(64)),
       Column('CORRELATIONID', String(64)), )
queue.create()

I am also using the "SessionMaker" in other parts of the code...

self._sessionmaker = sessionmaker(bind=self._engine)
            self._session = self._sessionmaker()

But I will try some other stuff now and see if I can get it to work...

Thanks

Lynton

On Mar 8, 4:41 pm, "Michael Bayer" <mike...@zzzcomputing.com> wrote:
> 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.- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

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