Source code for airflow.models.knownevent
# -*- 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 airflow.models.base import Base
from sqlalchemy import Column, String, Integer, ForeignKey, Text
from airflow.utils.sqlalchemy import UtcDateTime
from sqlalchemy.orm import relationship
[docs]class KnownEventType(Base):
[docs]    __tablename__ = "known_event_type" 
[docs]    id = Column(Integer, primary_key=True) 
[docs]    know_event_type = Column(String(200)) 
[docs]    def __repr__(self):
        return self.know_event_type  
[docs]class KnownEvent(Base):
[docs]    __tablename__ = "known_event" 
[docs]    id = Column(Integer, primary_key=True) 
[docs]    label = Column(String(200)) 
[docs]    start_date = Column(UtcDateTime) 
[docs]    end_date = Column(UtcDateTime) 
[docs]    user_id = Column(Integer(), ForeignKey('users.id'),) 
[docs]    known_event_type_id = Column(Integer(), ForeignKey('known_event_type.id'),) 
[docs]    reported_by = relationship(
        "User", cascade=False, cascade_backrefs=False, backref='known_events') 
[docs]    event_type = relationship(
        "KnownEventType",
        cascade=False,
        cascade_backrefs=False, backref='known_events') 
[docs]    description = Column(Text) 
[docs]    def __repr__(self):
        return self.label