You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bo...@apache.org on 2016/11/07 18:23:40 UTC

incubator-airflow git commit: [AIRFLOW-618] Cast DateTimes to avoid sqllite errors

Repository: incubator-airflow
Updated Branches:
  refs/heads/master 286c0478a -> f19277003


[AIRFLOW-618] Cast DateTimes to avoid sqllite errors

For some reason, sqllite does not always match
datetimes correctly.
This causes unit test failures, in particular the
trigger_dagrun test.
Casting the datetime explicitly appears to solve
the issue.

Closes #1871 from jlowin/failing-sqlite-test


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

Branch: refs/heads/master
Commit: f1927700380648d1e426397f79087cf7d44eb795
Parents: 286c047
Author: jlowin <jl...@apache.org>
Authored: Mon Nov 7 19:23:14 2016 +0100
Committer: Bolke de Bruin <bo...@xs4all.nl>
Committed: Mon Nov 7 19:23:24 2016 +0100

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


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/f1927700/airflow/models.py
----------------------------------------------------------------------
diff --git a/airflow/models.py b/airflow/models.py
index 1207f14..3509a0c 100755
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -3650,9 +3650,11 @@ class DagRun(Base):
         """
         DR = DagRun
 
+        exec_date = func.cast(self.execution_date, DateTime)
+
         dr = session.query(DR).filter(
             DR.dag_id == self.dag_id,
-            DR.execution_date == self.execution_date,
+            func.cast(DR.execution_date, DateTime) == exec_date,
             DR.run_id == self.run_id
         ).one()