-
-
Notifications
You must be signed in to change notification settings - Fork 679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I bulk delete with conditions? #403
Labels
question
Further information is requested
Comments
You can use from sqlalchemy import delete
stmt = delete(Item).where(Item.id.in_([1, 2, 3]))
session.exec(stmt)
session.commit() |
Thanks @meirdev, I've managed to do delete this way: My model:
Delete code:
|
Thanks for the help here @meirdev ! 👏 🙇 Thanks for reporting back and closing the issue @nghianv19940 👍 |
Deleting this way doesn't pass type check. I have the following code from sqlmodel import delete
session.exec(delete(Tags).where(Tags.registry_id == entry.id)) And pypy will fail with:
I see this is being discussed in #909 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First Check
Commit to Help
Example Code
Description
I can't find any instruction on https://sqlmodel.tiangolo.com/tutorial/ for this, please help!.
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.6
Python Version
3.10
Additional Context
No response
The text was updated successfully, but these errors were encountered: