kaxil commented on a change in pull request #7217: [AIRFLOW-5946] Store source code in db URL: https://github.com/apache/airflow/pull/7217#discussion_r391761310
########## File path: airflow/models/dagcode.py ########## @@ -0,0 +1,147 @@ +# 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. +import logging +import os +import struct +from datetime import datetime, timedelta +from typing import Iterable, List + +from sqlalchemy import BigInteger, Column, String, UnicodeText, and_, exists + +from airflow.exceptions import AirflowException +from airflow.models import Base +from airflow.utils import timezone +from airflow.utils.file import correct_maybe_zipped, open_maybe_zipped +from airflow.utils.session import provide_session +from airflow.utils.sqlalchemy import UtcDateTime + +log = logging.getLogger(__name__) + + +class DagCode(Base): + """A table for DAGs code. + + dag_code table contains code of DAG files synchronized by scheduler. + This feature is controlled by: + + * ``[core] store_serialized_dags = True``: enable this feature + * ``[core] store_dag_code = True``: enable this feature + + For details on dag serialization see SerializedDagModel + """ + __tablename__ = 'dag_code' + + fileloc_hash = Column( + BigInteger, nullable=False, primary_key=True, autoincrement=False) + fileloc = Column(String(2000), nullable=False) + # The max length of fileloc exceeds the limit of indexing. + last_updated = Column(UtcDateTime, nullable=False) + source_code = Column(UnicodeText(), nullable=False) Review comment: ```suggestion source_code = Column(UnicodeText, nullable=False) ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
