def write_record(cls, record): """Writes a record to the database. :param PipelineStore record: """ Session.merge(record) Session.commit()
def write_record(cls, record): """Writes a record to the database. :param TaskConnectionStore record: """ Session.merge(record) Session.commit()
def fetch_task_by_id(cls, id): """Fetches task record by id. :param str id: :returns TaskStore: record """ return (Session.query(TaskStore).filter(TaskStore.id == id).one())
def fetch_pipeline_by_id(cls, id): """Returns pipeline record by id. :param str id: :returns PipelineStore: record """ return (Session.query(PipelineStore).filter( PipelineStore.id == id).one())
def fetch_connections_for_pipeline(cls, pipeline_id): """Fetches list of task connections for a pipeline id. :param str pipeline_id: :returns list: TaskConnectionStore """ return (Session.query(TaskConnectionStore).filter( TaskConnectionStore.pipeline_id == pipeline_id)).all()
def fetch_connections_for_pipeline(cls, pipeline_id): """Fetches list of task connections for a pipeline id. :param str pipeline_id: :returns list: TaskConnectionStore """ return ( Session.query(TaskConnectionStore) .filter(TaskConnectionStore.pipeline_id == pipeline_id) ).all()
def fetch_pipeline_by_id(cls, id): """Returns pipeline record by id. :param str id: :returns PipelineStore: record """ return ( Session.query(PipelineStore) .filter(PipelineStore.id == id) .one() )
def fetch_schedule_for_pipeline(cls, pipeline_id): """Returns PipelineScheduleStore for a pipeline_id. :param str pipeline_id: :returns PipelineScheduleStore: """ return ( Session.query(PipelineScheduleStore) .filter(PipelineScheduleStore.pipeline_id == pipeline_id) .one() )
def fetch_schedules_to_run(cls): """Return a list of PipelineScheduleStores that need to run. :returns list: PipelineScheduleStore """ return ( Session.query(PipelineScheduleStore) .filter(PipelineScheduleStore.next_run_at <= datetime.utcnow()) .filter(PipelineScheduleStore.locked == False) # noqa .all() )
def fetch_task_by_id(cls, id): """Fetches task record by id. :param str id: :returns TaskStore: record """ return ( Session.query(TaskStore) .filter(TaskStore.id == id) .one() )