Skip to content

Commit

Permalink
Support auto convertion of timestamp/date datatypes in sqlite to date…
Browse files Browse the repository at this point in the history
…time.data objects. Closes webpy#22.

The datetime datatype is still converted to a string. The sqlite3 python driver only supports timestamp datatype.
  • Loading branch information
anandology committed Aug 26, 2010
1 parent 84205cf commit ee95ac7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions web/db.py
Expand Up @@ -962,6 +962,10 @@ def __init__(self, **keywords):

if db.__name__ in ["sqlite3", "pysqlite2.dbapi2"]:
db.paramstyle = 'qmark'

# sqlite driver doesn't create datatime objects for timestamp columns unless `detect_types` option is passed.
# It seems to be supported in sqlite3 and pysqlite2 drivers, not surte about sqlite.
keywords.setdefault('detect_types', db.PARSE_DECLTYPES)

self.paramstyle = db.paramstyle
keywords['database'] = keywords.pop('db')
Expand Down

0 comments on commit ee95ac7

Please sign in to comment.