.. changelog::
:version: 1.0.10
+ .. change::
+ :tags: bug, mysql
+ :tickets: 3602
+ :versions: 1.1.0b1
+
+ Fixed bug in MySQL reflection where the "fractional sections portion"
+ of the :class:`.mysql.DATETIME`, :class:`.mysql.TIMESTAMP` and
+ :class:`.mysql.TIME` types would be incorrectly placed into the
+ ``timestamp`` attribute, which is unused by MySQL, instead of the
+ ``fsp`` attribute.
+
.. change::
:tags: bug, orm
:tickets: 3599
# Column type keyword options
type_kw = {}
+
+ if issubclass(col_type, (DATETIME, TIME, TIMESTAMP)):
+ if type_args:
+ type_kw['fsp'] = type_args.pop(0)
+
for kw in ('unsigned', 'zerofill'):
if spec.get(kw, False):
type_kw[kw] = True
specs = []
for type_ in (mysql.TIMESTAMP, mysql.DATETIME, mysql.TIME):
- typespec = type_()
- specs.append((typespec, typespec))
+ # MySQL defaults fsp to 0, and if 0 does not report it.
+ # we don't actually render 0 right now in DDL but even if we do,
+ # it comes back blank
+ for fsp in (None, 0, 5):
+ if fsp:
+ specs.append((type_(fsp=fsp), type_(fsp=fsp)))
+ else:
+ specs.append((type_(), type_()))
specs.extend([
(TIMESTAMP(), mysql.TIMESTAMP()),