Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zipline v3 ingest fails due to SQLAlchemy 2.0 not releasing database connection #209

Closed
RichardDale opened this issue Jul 18, 2023 · 2 comments

Comments

@RichardDale
Copy link

RichardDale commented Jul 18, 2023

By default, SQLAlchemy v2 now uses connection pooling to improve performance for subsequent database connections.

However, the side effect of this is that the connection is not released for some time, and this interferes with Zipline's ingestion process whereby a temporary directory and database is created and then subsequently copied over, and the cleanup removes the temporary directory. The database file is still open and causes the temporary folder cleanup routines to fail on certain operating systems (eg. Windows).

Easy solution: Don't use connection pooling

utils/sqlite_utils.py

Add this at line 19:

from sqlalchemy.pool import NullPool

Line 46, change from:

    return sa.create_engine("sqlite:///" + path)

to:

    return sa.create_engine("sqlite:///" + path, poolclass=NullPool)
stefan-jansen added a commit that referenced this issue Jul 18, 2023
* disable connection pooling so ingestion works on Windows (see #209)
* DOC: updating docs
* fix link syntax
@stefan-jansen
Copy link
Owner

Closed by #210.

@RichardDale
Copy link
Author

@stefan-jansen Could you please release this urgent fix to conda-forge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants