(no title)
keyneus | 10 years ago
SQLITE_ERROR, SQLITE_PERM, SQLITE_ABORT, SQLITE_BUSY, SQLITE_LOCKED, SQLITE_READONLY, SQLITE_INTERRUPT, SQLITE_IOERR, SQLITE_FULL, SQLITE_CANTOPEN, SQLITE_PROTOCOL, SQLITE_EMPTY, SQLITE_SCHEMA
How do you know which? The only thing you can do is convert the exception to a string and compare error messages. That's absurd.
How about IntegrityError? That's either SQLITE_CONSTRAINT or SQLITE_MISMATCH. Which one? Compare strings again.
If you need to use SQLite with python, apsw actually converts errors to discrete exceptions.
rogerbinns|10 years ago
Wanting a Python wrapper for SQLite that celebrated SQLite's features, functionality and semantics rather than paper them over is why I started APSW a decade ago. It also has considerably better testing and diagnostics, and is thread safe.
http://rogerbinns.github.io/apsw/pysqlite.html
coleifer|10 years ago
[1] http://docs.peewee-orm.com/
[2] http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#a...
[3] https://github.com/coleifer/peewee/blob/master/examples/redi...
agumonkey|10 years ago