[issue7394] sqlite3: some OperationalError exceptions should be ProgrammingError (PEP 249)
Gerhard Häring g...@ghaering.de added the comment: The error code SQLITE_ERROR from SQLite is used for runtime errors. These can either be caused by the programmer (table does not exist, SQL contains errors) or they can be other problems like constraint violations etc. To differentiate these we would need to parse the error message returned by sqlite3_errmsg(). This is a path I don't want to go: it's hard to get this right across current and future SQLite versions. So I'm closing this issue as wontfix. -- assignee: - ghaering resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7394] sqlite3: some OperationalError exceptions should be ProgrammingError (PEP 249)
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +ghaering ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7394] sqlite3: some OperationalError exceptions should be ProgrammingError (PEP 249)
Filip Gruszczyński grusz...@gmail.com added the comment: I have created some naive patch, that makes sqlite module raise ProgrammingError for SQLITE_ERROR code. But I don't know, whether it might raise ProgrammingError in situation, when OperationalError should be. Sqlite docs says: #define SQLITE_ERROR1 /* SQL error or missing database */ and I don't really know, whether missing database is operational error or a programming one. Seems like the first one, but this would error message string parsing, that doesn't seem to pretty. Could anyone suggest me, what else could be done? -- keywords: +patch nosy: +gruszczy Added file: http://bugs.python.org/file15418/sqlite_ProgrammingError.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7394] sqlite3: some OperationalError exceptions should be ProgrammingError (PEP 249)
New submission from dontbugme pythonbugsbugme...@spamavert.com: The following code raises OperationalError exceptions: python -c 'import sqlite3; sqlite3.connect(:memory:).execute(bad syntax)' python -c 'import sqlite3; sqlite3.connect(:memory:).execute(SELECT * FROM no_such_table)' python -c 'import sqlite3; sqlite3.connect(:memory:).execute(SELECT no_such_column)' But ProgrammingError should be raised, as per PEP 249: ProgrammingError Exception raised for programming errors, e.g. table not found or already exists, syntax error in the SQL statement, wrong number of parameters specified, etc. It must be a subclass of DatabaseError. -- components: Library (Lib) messages: 95719 nosy: dontbugme severity: normal status: open title: sqlite3: some OperationalError exceptions should be ProgrammingError (PEP 249) type: behavior versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7394 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com