Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue7394] sqlite3: some OperationalError exceptions should be ProgrammingError (PEP 249)

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Nov 25, 2009, 8:39 AM

Post #1 of 4 (296 views)
Permalink
[issue7394] sqlite3: some OperationalError exceptions should be ProgrammingError (PEP 249)

New submission from dontbugme <pythonbugsbugmenot [at] spamavert>:

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 <report [at] bugs>
<http://bugs.python.org/issue7394>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 30, 2009, 5:40 AM

Post #2 of 4 (256 views)
Permalink
[issue7394] sqlite3: some OperationalError exceptions should be ProgrammingError (PEP 249) [In reply to]

Filip Gruszczyński <gruszczy [at] gmail> 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_ERROR 1 /* 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 <report [at] bugs>
<http://bugs.python.org/issue7394>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Dec 11, 2009, 5:11 AM

Post #3 of 4 (223 views)
Permalink
[issue7394] sqlite3: some OperationalError exceptions should be ProgrammingError (PEP 249) [In reply to]

Changes by Antoine Pitrou <pitrou [at] free>:


----------
nosy: +ghaering

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7394>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Dec 18, 2009, 5:54 AM

Post #4 of 4 (210 views)
Permalink
[issue7394] sqlite3: some OperationalError exceptions should be ProgrammingError (PEP 249) [In reply to]

Gerhard Häring <gh [at] ghaering> 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 <report [at] bugs>
<http://bugs.python.org/issue7394>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.