anitakar commented on a change in pull request #7217: [AIRFLOW-5946] Store source code in db URL: https://github.com/apache/airflow/pull/7217#discussion_r391805786
########## File path: airflow/models/dag.py ########## @@ -591,6 +593,29 @@ def owner(self) -> str: """ return ", ".join({t.owner for t in self.tasks}) + def code(self): + if conf.getboolean('core', 'store_dag_code', fallback=False): + return self._get_code_from_db() + else: + return self._get_code_from_file() + + def _get_code_from_file(self): + with open_maybe_zipped(self.fileloc, 'r') as f: + code = f.read() + return code + + @provide_session + def _get_code_from_db(self, session=None): + fileloc_hash = DagCode.dag_fileloc_hash(self.fileloc) Review comment: Done ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services