-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
.delete_where()
returns []
when it should return self
#315
Labels
bug
Something isn't working
Comments
Or should we raise an error if you attempt to call |
simonw
added a commit
that referenced
this issue
Aug 10, 2021
simonw
added a commit
that referenced
this issue
Aug 10, 2021
NotJoeMartinez
added a commit
to NotJoeMartinez/yt-fts
that referenced
this issue
May 29, 2023
sqlite_utils won't commit changes when deleting records in `delete_channel`, might be something to do with the triggers added by full text search. Seems to be a known issue with the package - simonw/sqlite-utils#315 - simonw/sqlite-utils#159 It doesn't seem to have a problem effecting the rows within the function but the changes don't commit. ```python db = Database(db_name) cur = db.execute(f"DELETE FROM Channels WHERE channel_id = ?", [channel_id]) print(f"channels: {cur.rowcount}") cur = db.execute(f"DELETE FROM Subtitles WHERE video_id IN (SELECT video_id FROM Videos WHERE channel_id = ?)", [channel_id]) print(f"subs: {cur.rowcount}") cur = db.execute(f"DELETE FROM Videos WHERE channel_id = ?", [channel_id]) print(f"vids: {cur.rowcount}") # check if effectively deleted cur = db.execute(f"SELECT * FROM Channels WHERE channel_id = ?", [channel_id]) print("channels after: ", cur, cur.fetchall()) cur = db.execute(f"SELECT * FROM Videos WHERE channel_id = ?", [channel_id]) print("Vids after", cur, cur.fetchall()) cur = db.execute(f"SELECT * FROM Videos WHERE channel_id = ?", [channel_id]) ``` other thing I tried: ```python db = Database(db_name) db["Channels"].delete_where("channel_id = ?", [channel_id]) db["Subtitles"].delete_where("video_id IN (SELECT video_id FROM Videos WHERE channel_id = ?)", [channel_id]) db["Videos"].delete_where("channel_id = ?", [channel_id]) ``` Anyway there doesn't seem to be any issues with using python sqlite3 for the delete operations
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If the table doesn't exist it should still return
self
, not[]
:sqlite-utils/sqlite_utils/db.py
Lines 1676 to 1683 in ee469e3
Spotted with
mypy
while working on #312.The text was updated successfully, but these errors were encountered: