Insertmany Into The In Memory Sqllite Db - Sqlite Date Type Only Accepts Python Date Objects As Input
Solution 1:
SQLAlchemy takes care of the bind parameters and ordering. There is no need to worry about that.
You specified in your SQLAlchemy ORM metadata definition that you are handling a date column. SQLAlchemy then handles the translation to the correct form for the backend database. The error comes from SQLAlchemy, not SQLLite; SA translates date objects for you.
This goes both ways; even when using SQLLite, you can put date objects in, and when you query, you get date objects out again.
The reply to the post you link to talks about the same things there; use a String()
column if you wanted to store dates as strings, use datetime.date()
or datetime.datetime()
instances instead if you declare the column to be of type Date()
.
Your date
key is a string; use a datetime.date()
object instead to avoid the error:
{'jersey_colour': u'Blue',
'team': u'Toronto Maple Leafs',
'stadium': u'Air Canada Center',
'date': datetime.date(2013, 3, 25),
'assists': 301,
'goals': 151}
Post a Comment for "Insertmany Into The In Memory Sqllite Db - Sqlite Date Type Only Accepts Python Date Objects As Input"