You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/01/03 18:07:16 UTC

[GitHub] BasPH closed pull request #4381: [AIRFLOW-3468] Move KnownEventType out of models.py

BasPH closed pull request #4381: [AIRFLOW-3468] Move KnownEventType out of models.py
URL: https://github.com/apache/incubator-airflow/pull/4381
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/models/__init__.py b/airflow/models/__init__.py
index cbcf586ac2..4062066f10 100755
--- a/airflow/models/__init__.py
+++ b/airflow/models/__init__.py
@@ -4334,16 +4334,6 @@ def __repr__(self):
         return self.label
 
 
-class KnownEventType(Base):
-    __tablename__ = "known_event_type"
-
-    id = Column(Integer, primary_key=True)
-    know_event_type = Column(String(200))
-
-    def __repr__(self):
-        return self.know_event_type
-
-
 class KnownEvent(Base):
     __tablename__ = "known_event"
 
diff --git a/airflow/models/known_event_type.py b/airflow/models/known_event_type.py
new file mode 100644
index 0000000000..3b1d5f6a48
--- /dev/null
+++ b/airflow/models/known_event_type.py
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from sqlalchemy import Integer, Column, String
+
+from airflow.models.base import Base
+
+
+class KnownEventType(Base):
+    __tablename__ = "known_event_type"
+
+    id = Column(Integer, primary_key=True)
+    know_event_type = Column(String(200))
+
+    def __repr__(self):
+        return self.know_event_type
diff --git a/airflow/utils/db.py b/airflow/utils/db.py
index 021f0583d1..f767a03616 100644
--- a/airflow/utils/db.py
+++ b/airflow/utils/db.py
@@ -28,6 +28,7 @@
 import contextlib
 
 from airflow import settings
+from airflow.models.known_event_type import KnownEventType
 from airflow.utils.log.logging_mixin import LoggingMixin
 
 log = LoggingMixin().log
@@ -291,7 +292,7 @@ def initdb(rbac=False):
             host='cassandra', port=9042))
 
     # Known event types
-    KET = models.KnownEventType
+    KET = KnownEventType
     if not session.query(KET).filter(KET.know_event_type == 'Holiday').first():
         session.add(KET(know_event_type='Holiday'))
     if not session.query(KET).filter(KET.know_event_type == 'Outage').first():


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services