Hello everyone Quick question, I want to ask pleas...
# prefect-community
t
Hello everyone Quick question, I want to ask please help me out, I am unable to find out. I have a project named ABC in which flow name is let say XYZ now whenever I run my XYZ flow as everyone knows prefect give random names to the runs. Now I want to get the time at which the latest success run occurred using python. Please help me out. Thanks in advance!
@Joshua Grant Using prefect v1 version 1.2.4
j
are you using cloud? deleted my comment because I don't know anything about cloud. If you can access the orion API, you can query there
t
Yes we use cloud to run our flow. Need python code to get latest success flow run
j
if you can use the API, you can post this graphql query using requests (you can add some other adjustments to narrow it down, this query gives all the flow runs named "XYZ"):
Copy code
query FlowRuns {
  flow_run(where: {flow: {name: {_eq: "XYZ"}}}) {
   id
   state
   flow {
     name
   }
   name
   flow_id
   parameters
 }
}
🙏 1
if you have the interactive API available, you can test/adjust the query there to give you exactly what you want and then adjust the python requests payload
t
Thank you very much
👍 1