(C) Alec Muffett's DropSafe blog. Author Name: Alec Muffett This story was originally published on allecmuffett.com. [1] License: CC-BY-SA 3.0.[2] I love SQLite but OMG the bugs from namespace pollution in Python 2023-11-20 23:08:55+00:00 So I was doing an insert: ... try: self.cursor.execute(self.schemas[schema_key], params) rows_affected = cursor.rowcount self.commit() except sqlite3.IntegrityError as e: rows_affected = -1 finally: self.lock.release() # END PRIVILEGED CODE return rows_affected Do you see the bug that caused a silent failure of the INSERT statement? Yep, that should be self.cursor.rowcount in the try block; there were zero diagnostics and zero exceptions and zero failures, just nothing being written to the database. Literally zero diagnostics, I just had to mess with the code until I saw the issue. Presumably I was invoking some code hook into the cursor package namespace and silently trashing the insert before the commit happened; still not sure, because I think that at one point I may have been doing the commit BEFORE asking for the rowcount. Argh. [END] [1] URL: https://alecmuffett.com/article/108423 [2] URL: https://creativecommons.org/licenses/by-sa/3.0/ DropSafe Blog via Magical.Fish Gopher News Feeds: gopher://magical.fish/1/feeds/news/alecmuffett/