Skip to content

Conversation

YuriiMotov
Copy link
Member

@YuriiMotov YuriiMotov commented Oct 9, 2025

Currently we have a lot of deprecation warnings because we use fastapi.on_event in docs examples.
These warnings are useless and make it hard to read log of tests.
I suggest we just ignore "on_event is deprecated" warnings globally.

I also fixed import of ValidationError which also produced a deprecation warning.

With Pydantic V2 we still have 1 type of warnings:

SAWarning: Object of type <HeroTeamLink> not in session, add operation along 'Hero.team_links' 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 happened while initializing objects.)

Not sure how to fix this one..

See log
tests/test_tutorial/test_many_to_many/test_tutorial003.py::test_tutorial
tests/test_tutorial/test_many_to_many/test_tutorial003_py310.py::test_tutorial
tests/test_tutorial/test_many_to_many/test_tutorial003_py39.py::test_tutorial
  /home/yurii/code/sqlmodel_forks/motov/sqlmodel/sqlmodel/orm/session.py:144: SAWarning: Object of type <HeroTeamLink> not in session, add operation along 'Hero.team_links' 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 happened while initializing objects.)
    return super().execute(

tests/test_tutorial/test_many_to_many/test_tutorial003.py::test_tutorial
tests/test_tutorial/test_many_to_many/test_tutorial003_py310.py::test_tutorial
tests/test_tutorial/test_many_to_many/test_tutorial003_py39.py::test_tutorial
  /home/yurii/code/sqlmodel_forks/motov/sqlmodel/sqlmodel/orm/session.py:144: SAWarning: Object of type <HeroTeamLink> not in session, add operation along 'Team.hero_links' 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 happened while initializing objects.)
    return super().execute(

With Pydantic V1 we still have a lot of warnings, but they are not easily fixable.
Anyway, with this PR we will have less warnings and it will be easier to review test logs

Copy link
Contributor

github-actions bot commented Oct 9, 2025

📝 Docs preview

Last commit 7c8a330 at: https://4709c771.sqlmodel.pages.dev

@YuriiMotov YuriiMotov marked this pull request as ready for review October 9, 2025 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant