Summary
docassemble/AssemblyLine/sessions.py imports a private docassemble webapp helper that no longer exists in docassemble 1.10.0:
from docassemble.webapp.db_object import init_sqlalchemy
...
db = init_sqlalchemy()
In current jhpyle/docassemble 1.10.0, docassemble.webapp.db_object is gone. The replacement low-level DB access helpers appear to live in docassemble.webapp.db, which exposes get_session() and session_scope() context managers.
Why this breaks
This is an import-time failure: any code path that imports docassemble.AssemblyLine.sessions under docassemble 1.10.0 will fail with something like:
ModuleNotFoundError: No module named 'docassemble.webapp.db_object'
The affected functions then use db.connect() to run raw SQL queries in:
get_saved_interview_list()
find_matching_sessions()
delete_interview_sessions()
Proposed fix
Replace the old private engine initialization with the 1.10.0 DB session helpers:
from docassemble.webapp.db import get_session, session_scope
Then update the raw SQL call sites roughly as follows:
# SELECT-style queries
with get_session() as session:
rs = session.execute(get_sessions_query, parameters)
for row in rs:
sessions.append(dict(row._mapping))
# DELETE / write-style queries
with session_scope() as session:
session.execute(delete_sessions_query, parameters)
This keeps the existing SQL mostly intact while avoiding the removed init_sqlalchemy() helper.
Test suggestion
Add a simple import smoke test against docassemble 1.10.0:
python - <<'PY'
import docassemble.AssemblyLine.sessions
PY
A more complete regression test should exercise the three affected session-list/session-delete functions inside a docassemble app/database context.
Notes
This is probably a relatively small code change, but it should be tested with a real initialized docassemble 1.10.0 database context because it changes from using a raw SQLAlchemy engine connection to docassemble's current session helpers.
Summary
docassemble/AssemblyLine/sessions.pyimports a private docassemble webapp helper that no longer exists in docassemble 1.10.0:In current
jhpyle/docassemble1.10.0,docassemble.webapp.db_objectis gone. The replacement low-level DB access helpers appear to live indocassemble.webapp.db, which exposesget_session()andsession_scope()context managers.Why this breaks
This is an import-time failure: any code path that imports
docassemble.AssemblyLine.sessionsunder docassemble 1.10.0 will fail with something like:The affected functions then use
db.connect()to run raw SQL queries in:get_saved_interview_list()find_matching_sessions()delete_interview_sessions()Proposed fix
Replace the old private engine initialization with the 1.10.0 DB session helpers:
Then update the raw SQL call sites roughly as follows:
This keeps the existing SQL mostly intact while avoiding the removed
init_sqlalchemy()helper.Test suggestion
Add a simple import smoke test against docassemble 1.10.0:
A more complete regression test should exercise the three affected session-list/session-delete functions inside a docassemble app/database context.
Notes
This is probably a relatively small code change, but it should be tested with a real initialized docassemble 1.10.0 database context because it changes from using a raw SQLAlchemy engine connection to docassemble's current session helpers.