def get_event_log(*, event_log_id: int, session: Session = NEW_SESSION) -> APIResponse: """Get a log entry""" event_log = session.query(Log).get(event_log_id) if event_log is None: raise NotFound("Event Log not found") return event_log_schema.dump(event_log)
def get_event_log(event_log_id, session): """ Get a log entry """ event_log = session.query(Log).filter(Log.id == event_log_id).one_or_none() if event_log is None: raise NotFound("Event Log not found") return event_log_schema.dump(event_log)
def test_serialize(self, session): event_log_model = Log(event="TEST_EVENT", task_instance=self._create_task_instance()) session.add(event_log_model) session.commit() event_log_model.dttm = timezone.parse(self.default_time) log_model = session.query(Log).first() deserialized_log = event_log_schema.dump(log_model) assert deserialized_log == { "event_log_id": event_log_model.id, "event": "TEST_EVENT", "dag_id": "TEST_DAG_ID", "task_id": "TEST_TASK_ID", "execution_date": self.default_time, "owner": 'airflow', "when": self.default_time, "extra": None, }