# Strange warning about SQL

**URL:** <https://aiida.discourse.group/t/strange-warning-about-sql/402>\
**Category:** General Usage\
**Created:** [May 28, 2024, 3:10pm UTC](https://aiida.discourse.group/t/strange-warning-about-sql/402 "2024-05-28T15:10:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bastonero](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/bastonero/32/32_2.png) [@bastonero](https://aiida.discourse.group/u/bastonero)\
**Post date:** [May 28, 2024, 3:10pm UTC](https://aiida.discourse.group/t/strange-warning-about-sql/402/1 "2024-05-28T15:10:09Z")

</div>

Dear all,

It’s been a while I keep getting this warning anytime I submit a calculation:

```auto
/home/bastonero/.conda/envs/aiida/lib/python3.9/site-packages/aiida/storage/psql_dos/orm/querybuilder/main.py:146: 
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.)

```

It seems it’s not really something to worry about, but I wanted to understand:

1. Whether it is something that can be fixed
2. If it is (sort of) bad
3. In case, how to disable the warning

Thanks a lot for any pointer!

---

<div class="post-metadata">

**Author:** ![sphuber](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/sphuber/32/6_2.png) [@sphuber](https://aiida.discourse.group/u/sphuber)\
**Post date:** [May 28, 2024, 3:28pm UTC](https://aiida.discourse.group/t/strange-warning-about-sql/402/2 "2024-05-28T15:28:18Z")

</div>

See the explanation in this PR: [ORM: Filter inconsequential warnings from `sqlalchemy` by sphuber · Pull Request #6192 · aiidateam/aiida-core · GitHub](https://github.com/aiidateam/aiida-core/pull/6192)  
As well as the actual work around in the code: [aiida-core/src/aiida/storage/psql\_dos/orm/\_\_init\_\_.py at main · aiidateam/aiida-core · GitHub](https://github.com/aiidateam/aiida-core/blob/main/src/aiida/storage/psql_dos/orm/ __init__.py)

Essentially the work around is to silence the warning by capturing it. Unfortunately, when you run `pytest`, this capture is undone, so you have to configure it again in `pytest` to capture it. See here: [aiida-core/pyproject.toml at 9e3ebf6ea55d883c7857a1dbafe398b9579cca03 · aiidateam/aiida-core · GitHub](https://github.com/aiidateam/aiida-core/blob/9e3ebf6ea55d883c7857a1dbafe398b9579cca03/pyproject.toml#L365)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/aiida/original/1X/c417197d3750949351575d03ed03f5e2ad32e649.png) [@system](https://aiida.discourse.group/u/system)\
**Post date:** [June 3, 2024, 11:29am UTC](https://aiida.discourse.group/t/strange-warning-about-sql/402/3 "2024-06-03T11:29:15Z")

</div>

Closed on June 3, 2024, 11:29am UTC

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
