MySQL TIMESTAMP with fractional second part is reflected incorrectly
Issue #3602
resolved
It happens because sqlalchemy.dialects.mysql.base.TIMESTAMP
has timezone
kwarg as its first argument, so TIMESTAMP(3)
is incorrectly parsed as TIMESTAMP(timezone=3)
instead of TIMESTAMP(fsp=3)
.
Reproduced on sqlalchemy-1.0.9.
Comments (7)
-
repo owner -
reporter Sure. I guess I have spent too much time (more than I should be) writing bug reports recently and this one felt too obvious. Is this OK:
>>> engine.execute('create table foobar(ts timestamp(3));') <sqlalchemy.engine.result.ResultProxy at 0x7f990fc2ba50> >>> sa.inspect(engine).get_columns('foobar') [{'default': None, 'name': u'ts', 'nullable': False, 'type': TIMESTAMP(timezone=3)}]
-
repo owner - changed status to resolved
- 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 thetimestamp
attribute, which is unused by MySQL, instead of thefsp
attribute. fixes#3602
→ <<cset 3f42743d6aa1>>
-
repo owner - 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 thetimestamp
attribute, which is unused by MySQL, instead of thefsp
attribute. fixes#3602
(cherry picked from commit 3f42743d6aa1326a80a0ed720a92266aa5fbf209)
→ <<cset f3137aa45998>>
- Fixed bug in MySQL reflection where the "fractional sections portion"
of the :class:
-
repo owner thanks for reporting!
-
repo owner - changed milestone to 1.0.xx
-
reporter Thank you for the quick fix! (there's a typo in the changelog message: the attribute is
timezone
, nottimestamp
) - Log in to comment
care to provide an mcve ? this is just good bug reporting etiquette, thanks!