diff options
Diffstat (limited to 'lib/sqlalchemy/databases/mysql.py')
-rw-r--r-- | lib/sqlalchemy/databases/mysql.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py index 139328039..766748c62 100644 --- a/lib/sqlalchemy/databases/mysql.py +++ b/lib/sqlalchemy/databases/mysql.py @@ -551,9 +551,14 @@ class MSTimeStamp(sqltypes.TIMESTAMP): class MSYear(sqltypes.TypeEngine): """MySQL YEAR type, for single byte storage of years 1901-2155""" - def get_col_spec(self): - return "YEAR" + def __init__(self, length=None): + self.length = length + def get_col_spec(self): + if self.length is None: + return "YEAR" + else: + return "YEAR(%s)" % self.length class MSText(_StringType, sqltypes.TEXT): """MySQL TEXT type, for text up to 2^16 characters""" |