Hi, I have 2 tasks - first one fetches data, secon...
# prefect-community
Hi, I have 2 tasks - first one fetches data, second one inserts the fetched data into a database The tasks will be run on a TimeInterval schedule. I have cached the first tasks's output. How do I avoid running the second task if the cached output from the first task is still valid i.e. cache age is still < 1 day?
Copy code
def fetch_data():
    return fetched_data

def insert_into_database(fetched_data):
    fetched_data.to_sql('table_name', con=db.engine)
Hello @nicholas, would you happen to have any insight on this?
Hey @CA Lee, I think you can approach this by implementing a custom trigger on the second task that explicitly checks the cache expiration attribute of the state of 
, then executes
. I don't have a snippet, but I'll try to write/find an example of a custom trigger.