sqlite3, OperationalError: no such column, shouldn't that ne a ProgrammingError?

Gabriel Rossetti gabriel.rossetti at arimaz.com
Wed Jun 17 09:15:04 CEST 2009


John Machin wrote:
> On Jun 17, 1:41 am, Gabriel Rossetti <gabriel.rosse... at arimaz.com>
> wrote:
>   
>> Hello everyone,
>>
>> I get an OperationalError with sqlite3 if I put the wrong column name,
>> but shouldn't that be a ProgrammingError instead? I read PEP 249 and it
>> says :
>>
>>     
> [snip]
>   
>> and to me it sounds more like a programming error than an operational
>> error.
>>     
>
> How about showing us the code you used and the exact error message and
> traceback?
>
>
>   
Well, the code isn't really relevant to the problem, but here is is :

import sqlite3

conn = sqlite3.connect("/tmp/test.db")
conn.execute("SELECT name, value FROM local_param")

for row in conn:
    print row

And I get :

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
sqlite3.OperationalError: no such table: local_param


Which I think should be a ProgrammingError

If I fix the table name I but use a wrong column name I also get an 
OperationalError


import sqlite3

conn = sqlite3.connect("/tmp/test.db")
conn.execute("SELECT name, valueeeeeeee FROM local_parameters")

for row in conn:
    print row

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
sqlite3.OperationalError: no such column: valueeeeeeee

Which should also be a ProgrammingError as I see it and as my 
interpretation of the documention.

Gabriel




More information about the Python-list mailing list