How ignore model change #6308
Unanswered
leandrogmuller
asked this question in
Usage Questions
Replies: 1 comment 1 reply
-
hi, you can use expunge to remove an object from a session. https://docs.sqlalchemy.org/en/14/orm/session_api.html?highlight=merge#sqlalchemy.orm.Session.expunge that way its changes will no longer tracked by the session |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello.
How can I ignore changes on model?
Example.
engine = create_engine("postgresql://user:pass@localhost:5432/datadev",
poolclass=NullPool)
session_factory = sessionmaker(bind=engine)
session = session_factory()
lang03 = session.query(Lang03).filter(Lang03.pkge == 'kernel').first()
lang03.text = 'd' # I dont't whant to change on database.
session.commit()
session.close()
Beta Was this translation helpful? Give feedback.
All reactions