I have an application that needs to support Python 2.4 and 2.6. With 2.6, sqlite3 replaces sqlite. Is there much else I need to worry about other than paramstyle differences? Is this a decent way of handling that?
try:
import sqlite3 as sqlite
except ImportError:
import sqlite
...
if sqlite.paramstyle == 'qmark':
query = 'SELECT foo FROM bar where baz = ?'
else:
query = 'SELECT foo FROM bar where baz = %s'
cursor.execute(query, params)