Warning about SQL

Hi aiida team,
after updating aiida-quantumespresso to 4.9.0 and aiida-core to 2.6.3, I’ve been getting the following warnings:

/home/anaconda3/envs/aiida/lib/python3.9/site-packages/aiida/storage/psql_dos/orm/utils.py:84: SAWarning: Object of type <DbNode> not in session, add operation along 'DbUser.dbnodes' will not proceed (This warning originated from the Session 'autoflush' process, which was invoked automatically in response to a user-initiated operation. Consider using ``no_autoflush`` context manager if this warning happended while initializing objects.)
  return getattr(self._model, item)
/home/anaconda3/envs/aiida/lib/python3.9/site-packages/aiida/storage/psql_dos/orm/querybuilder/main.py:182: SAWarning: Object of type <DbNode> not in session, add operation along 'DbUser.dbnodes' will not proceed (This warning originated from the Session 'autoflush' process, which was invoked automatically in response to a user-initiated operation. Consider using ``no_autoflush`` context manager if this warning happended while initializing objects.)
  result = build.query.count()

I found a similar question from May 2024 (Strange warning about SQL). The answer suggests that the warning should have been suppressed, and given that I have the latest version of aiida-core, I was wondering if there is anything else going on.

Thanks for any hints you may provide!

Hi @gsavva, sorry for the slow reply. Indeed looking at the other topic and PR this should have been fixed, and I haven’t run into the warnings anymore with the versions you specify. When do you see these warnings? When submitting work chains?

Thanks @mbercx. yes, I saw these warnings when submitting workchains.

Eventually I had to downgrade aiida-quantumespresso from 4.9.0 to 4.6.0 ( but aiida-core remains in version 2.6.3) and the warnings disappear.

Might be useful to note, for reference, that my current SQLAlchemy version is 2.0.39.

Hmm, strange. Which work chain are you running? Maybe I can try to reproduce the issue for aiida-quantumespresso==4.9.0.

Which work chain are you running?

PwBaseWorkChain