diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-12-20 01:45:36 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-12-20 01:45:36 +0000 |
commit | 267523e4da6a6575fae507eabd003e975fc7094f (patch) | |
tree | cb3f6291b39fa61670889321092b4e3d892436da /lib/sqlalchemy/databases/sqlite.py | |
parent | a9c7e6f774f25d0e888d1b1dad5c4d0b2e6a2c93 (diff) | |
download | sqlalchemy-267523e4da6a6575fae507eabd003e975fc7094f.tar.gz |
- sqlite SLDate type will not erroneously render "microseconds" portion
of a datetime or time object when sent to the DB.
Diffstat (limited to 'lib/sqlalchemy/databases/sqlite.py')
-rw-r--r-- | lib/sqlalchemy/databases/sqlite.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sqlalchemy/databases/sqlite.py b/lib/sqlalchemy/databases/sqlite.py index e028b1c53..0d673e9ab 100644 --- a/lib/sqlalchemy/databases/sqlite.py +++ b/lib/sqlalchemy/databases/sqlite.py @@ -50,7 +50,7 @@ class DateTimeMixin(object): # pass string values thru return value elif value is not None: - if getattr(value, 'microsecond', None) is not None: + if self.__microsecond__ and getattr(value, 'microsecond', None) is not None: return value.strftime(self.__format__ + "." + str(value.microsecond)) else: return value.strftime(self.__format__) @@ -70,6 +70,7 @@ class DateTimeMixin(object): class SLDateTime(DateTimeMixin,sqltypes.DateTime): __format__ = "%Y-%m-%d %H:%M:%S" + __microsecond__ = True def get_col_spec(self): return "TIMESTAMP" @@ -82,6 +83,7 @@ class SLDateTime(DateTimeMixin,sqltypes.DateTime): class SLDate(DateTimeMixin, sqltypes.Date): __format__ = "%Y-%m-%d" + __microsecond__ = False def get_col_spec(self): return "DATE" @@ -94,6 +96,7 @@ class SLDate(DateTimeMixin, sqltypes.Date): class SLTime(DateTimeMixin, sqltypes.Time): __format__ = "%H:%M:%S" + __microsecond__ = True def get_col_spec(self): return "TIME" |