- changed status to resolved
mssql datetime2 doesn't adapt correctly
Issue #2159
resolved
only in 0.6, as adapt() was rewritten in 0.7.
from sqlalchemy import *
from sqlalchemy.dialects.mssql import DATETIME2
import datetime
e = create_engine('mssql+pyodbc://scott:tiger@ms_2005/', echo=True)
m = MetaData(e)
t1 = Table('t', m, Column('x', DATETIME2))
m.drop_all()
m.create_all()
t1.insert().execute(x=datetime.datetime.now())
t1.select().execute().fetchall()
File "/Users/classic/dev/sa06/lib/sqlalchemy/engine/default.py", line 224, in type_descriptor
return sqltypes.adapt_type(typeobj, self.colspecs)
File "/Users/classic/dev/sa06/lib/sqlalchemy/types.py", line 796, in adapt_type
return typeobj.adapt(impltype)
File "/Users/classic/dev/sa06/lib/sqlalchemy/types.py", line 1361, in adapt
return impltype(timezone=self.timezone)
AttributeError: 'DATETIME2' object has no attribute 'timezone'
Comments (2)
-
reporter -
reporter - removed milestone
Removing milestone: 0.6.8 (automated comment)
- Log in to comment
3a34dc7eae523e182eba5329c753bee78010ea82
added the test to 0.7 in 772ae63bdbfb82509bf2df20e56722b4cdc6186b