unconditionally quoted, so that schema names which need quoting are fine.
its slightly unnecessary for schema names which don't need quoting
but not harmful.
+- sqlite
+ - passthrough for stringified dates
0.3.10
- general
class DateTimeMixin(object):
def convert_bind_param(self, value, dialect):
- if value is not None:
+ if isinstance(value, basestring):
+ # pass string values thru
+ return value
+ elif value is not None:
if getattr(value, 'microsecond', None) is not None:
return value.strftime(self.__format__ + "." + str(value.microsecond))
else:
l = map(list, users_with_date.select().execute().fetchall())
self.assert_(l == insert_data, 'DateTest mismatch: got:%s expected:%s' % (l, insert_data))
+ @testbase.supported('sqlite')
+ def test_sqlite_date(self):
+ meta = MetaData(testbase.db)
+ t = Table('testdate', meta,
+ Column('id', Integer, primary_key=True),
+ Column('adate', Date),
+ Column('adatetime', DateTime))
+ t.create(checkfirst=True)
+ try:
+ d1 = datetime.date(2007, 10, 30)
+ d2 = datetime.datetime(2007, 10, 30)
+
+ t.insert().execute(adate=str(d1), adatetime=str(d2))
+
+ assert t.select().execute().fetchall()[0] == (1, datetime.date(2007, 10, 30), datetime.datetime(2007, 10, 30))
+ finally:
+ t.drop(checkfirst=True)
def testtextdate(self):
x = db.text("select user_datetime from query_users_with_date", typemap={'user_datetime':DateTime}).execute().fetchall()