Repository: incubator-airflow
Updated Branches:
  refs/heads/v1-8-test 3975d3dad -> 302520828


[AIRFLOW-809][AIRFLOW-1] Use __eq__ ColumnOperator When Testing Booleans

The .is_ ColumnOperator causes the SqlAlchemy's
MSSQL dialect to produce
IS 0 when given a value of False rather than a
value of None. The __eq__
ColumnOperator does this same test with the added
benefit that it will
modify the resulting expression from and == to a
IS NULL when the target
is None.

This change replaces all is_ ColumnOperators that
are doing boolean
comparisons and leaves all is_ ColumnOperators
that are checking for
None values.

Closes #2022 from gritlogic/AIRFLOW-809


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/9a53e663
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/9a53e663
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/9a53e663

Branch: refs/heads/v1-8-test
Commit: 9a53e66390670c7a9e4206f0a3ef4a19c1baae72
Parents: 3975d3d
Author: Chad Henderson <[email protected]>
Authored: Sun Feb 19 10:03:18 2017 +0100
Committer: Maxime Beauchemin <[email protected]>
Committed: Thu Jun 22 15:19:45 2017 -0700

----------------------------------------------------------------------
 airflow/models.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/9a53e663/airflow/models.py
----------------------------------------------------------------------
diff --git a/airflow/models.py b/airflow/models.py
index 737d4c8..4e2abd7 100755
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -469,7 +469,7 @@ class DagBag(BaseDagBag, LoggingMixin):
     def paused_dags(self):
         session = settings.Session()
         dag_ids = [dp.dag_id for dp in session.query(DagModel).filter(
-            DagModel.is_paused.is_(True))]
+            DagModel.is_paused.__eq__(True))]
         session.commit()
         session.close()
         return dag_ids
@@ -2858,7 +2858,7 @@ class DAG(BaseDag, LoggingMixin):
             DR.dag_id == self.dag_id,
         )
         if not include_externally_triggered:
-            qry = qry.filter(DR.external_trigger.is_(False))
+            qry = qry.filter(DR.external_trigger.__eq__(False))
 
         qry = qry.order_by(DR.execution_date.desc())
 

Reply via email to