♻️ Ignore `on_event is deprecated` deprecation warnings, fix `ValidationError` import warning by YuriiMotov · Pull Request #1600 · fastapi/sqlmodel
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