Hello community! I started with Prefect flows yest...
# best-practices
Hello community! I started with Prefect flows yesterday, and I am interested in the scheduling feature. Is it possible to trigger the execution of a Flow based on: 1. update in the data csv file 2. new data in the database, etc?
also new beginner here (not prefect employee) I think you can add web hook of some sort. send HTTP request to trigger Prefect flow run
when “things” happen, send a http request with some parameter to Prefect Cloud to trigger a Deployment, it would create a ’flow run” Am I right @Kevin Kho?
Yes you can. This is for Prefect 1 and this is for Prefect 2. For example, you can connect Lambda to S3 and then run a Flow
@Kevin Kho Link for Prefect 2 is 404
Ah ok will just paste the code:
Copy code
async def run(name: str):
    Create a flow run for the given flow and deployment.

    The flow run will be scheduled for now and an agent must execute it.

    The flow run will not execute until an agent starts.
    async with get_client() as client:
            deployment = await client.read_deployment_by_name(name)
        except ObjectNotFound:
            exit_with_error(f"Deployment {name!r} not found!")
        flow_run = await client.create_flow_run_from_deployment(deployment.id)

    console.print(f"Created flow run {flow_run.name!r} ({flow_run.id})")
no authentication at all? I don’t need to send JWT? is there are doc with more context? how get_client() work. Is this 1.0 or 2.0?
The client can load authentication
👍 1
Got it, client works very well.