samedi 7 novembre 2015

Why is this not a valid python DateTime insert in SQLite?

I'm getting the following error:

sqlalchemy.exc.StatementError: (exceptions.TypeError) SQLite DateTime type only accepts Python datetime and date objects as input.

When trying to insert the following datetime instance in the dvdrelease column:

'dvdrelease': datetime.datetime(2015, 11, 3, 0, 53, 32, 682000)

I'm using Arrow behind the scenes to do some string parsing, and arrow is returning the value in the code above (value = datetime.datetime(2015, 11, 3, 0, 53, 32, 682000))

But why does SQLite say this isn't a valid insert?

for what it's worth, here's how this Column is defined in my models.py file (a Flask web-app):

dvdrelease = db.Column(db.DateTime, index=True)

Aucun commentaire:

Enregistrer un commentaire