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 2018/01/18 12:57:07 UTC

incubator-airflow git commit: [AIRFLOW-2008] Use callable for python column defaults

Repository: incubator-airflow
Updated Branches:
  refs/heads/master bc72231b1 -> fbba5ef7c


[AIRFLOW-2008] Use callable for python column defaults

We were using timezone.utcnow() instead of a
callable. This
resulted in inserts with all the same values.

Closes #2949 from bolkedebruin/AIRFLOW-2008


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

Branch: refs/heads/master
Commit: fbba5ef7c3bae9a6ebf8496a7702bce65a9c1782
Parents: bc72231
Author: Bolke de Bruin <bo...@xs4all.nl>
Authored: Thu Jan 18 13:57:00 2018 +0100
Committer: Bolke de Bruin <bo...@xs4all.nl>
Committed: Thu Jan 18 13:57:00 2018 +0100

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


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/fbba5ef7/airflow/models.py
----------------------------------------------------------------------
diff --git a/airflow/models.py b/airflow/models.py
index f07e985..08c4b52 100755
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -737,7 +737,7 @@ class DagPickle(Base):
     """
     id = Column(Integer, primary_key=True)
     pickle = Column(PickleType(pickler=dill))
-    created_dttm = Column(UtcDateTime, default=timezone.utcnow())
+    created_dttm = Column(UtcDateTime, default=timezone.utcnow)
     pickle_hash = Column(Text)
 
     __tablename__ = "dag_pickle"
@@ -3975,7 +3975,7 @@ class Chart(Base):
         "User", cascade=False, cascade_backrefs=False, backref='charts')
     x_is_date = Column(Boolean, default=True)
     iteration_no = Column(Integer, default=0)
-    last_modified = Column(UtcDateTime, default=timezone.utcnow())
+    last_modified = Column(UtcDateTime, default=timezone.utcnow)
 
     def __repr__(self):
         return self.label
@@ -4124,7 +4124,7 @@ class XCom(Base, LoggingMixin):
     key = Column(String(512))
     value = Column(LargeBinary)
     timestamp = Column(
-        DateTime, default=timezone.utcnow(), nullable=False)
+        DateTime, default=timezone.utcnow, nullable=False)
     execution_date = Column(UtcDateTime, nullable=False)
 
     # source information
@@ -4443,8 +4443,8 @@ class DagRun(Base, LoggingMixin):
 
     id = Column(Integer, primary_key=True)
     dag_id = Column(String(ID_LEN))
-    execution_date = Column(UtcDateTime, default=timezone.utcnow())
-    start_date = Column(UtcDateTime, default=timezone.utcnow())
+    execution_date = Column(UtcDateTime, default=timezone.utcnow)
+    start_date = Column(UtcDateTime, default=timezone.utcnow)
     end_date = Column(UtcDateTime)
     _state = Column('state', String(50), default=State.RUNNING)
     run_id = Column(String(ID_LEN))