diff --git a/airflow/utils/sqlalchemy.py b/airflow/utils/sqlalchemy.py index b10af0a74d25a..c94b4100dd921 100644 --- a/airflow/utils/sqlalchemy.py +++ b/airflow/utils/sqlalchemy.py @@ -24,6 +24,7 @@ import pendulum from dateutil import relativedelta from sqlalchemy import and_, event, false, nullsfirst, or_, tuple_ +from sqlalchemy.dialects import mssql from sqlalchemy.exc import OperationalError from sqlalchemy.orm.session import Session from sqlalchemy.sql import ColumnElement @@ -94,6 +95,11 @@ def process_result_value(self, value, dialect): return value + def load_dialect_impl(self, dialect): + if dialect.name == 'mssql': + return mssql.DATETIME2(precision=6) + return super().load_dialect_impl(dialect) + class ExtendedJSON(TypeDecorator): """