records
records copied to clipboard
Example fails with `Cannot operate on a closed database.`
I see records will be upgraded to v5.3 supporting the connection pool. But it does not support lazy loading that the tests not cover.
However, when running the example it will report: "sqlalchemy.exc.ProgrammingError: (sqlite3.ProgrammingError) Cannot operate on a closed database."
I think it is because the cursor is closed out of the connection and when we want to retrieve the data using the old cursor. it does not exist.
Hope this issue will be fixed before pushed to v5.3.
Excellent catch! And I think your assessment of the problem is spot-on - there is a generator that depends on that cursor being open and it throws the reported error when we attempt to consume off of it. I'll take a closer look and see if I can come up with a solution.
Also, @kennethreitz, the connection pooling change I made (https://github.com/kennethreitz/records/pull/119) does have a non-backwards compatible API change (Database.transaction
doesn't behave how it used to). I assume that would warrant a bump to v6.0?
yes
Just to give an update (apologies for the delay). I have a fix for this, but would like to do a bit more testing. Hopefully I'll have a PR ready within a week.
@jian-en PR #147 has refactored test suite and all failing cases are reporting the Cannot operate on a closed database.
Issue #149 shows the same error, but it differs for sqlite:///:memory:
(which works well) and for sqlite:///some.file
(which fails).
For sqlite user, this issue has been fixed in #190 but not yet merged.
Until then, we can install the fix by doing the following
pipenv install git+https://github.com/gdtroszak/records.git@connection-fix-redux#egg=records