<@ULVA73B9P> i am creating the deployment using p...
# marvin-ai
k
@Marvin i am creating the deployment using python prefect sdk and prefect.yaml deployment_id = self.client.create_deployment( flow_id=flow_id, name=deployment_name, tags=tags, parameters=parameters, description=template["description"], entrypoint=template["entrypoint"], work_pool_name=WORK_POOL_NAME, schedules=schedules, concurrency_limit=template.get("concurrency_limit"), pull_steps=[ { "prefect.deployments.steps.git_clone": { "repository": GIT_REPO_URI, "branch": GIT_DEPLOYED_BRANCH_NAME, "access_token": "{{ prefect.blocks.secret.github-pat }}", } } ], ) deployments: - name: '[Byrtta]: Clickstream Aggregation' version: null tags: ['clickstream-aggregation', 'byrtta', '2427b5-28' , 'prod'] concurrency_limit: limit: 1 collision_strategy: CANCEL_NEW description: |- Responsible for Running Clickstream Lineage Models Powering Attryb Personalization Args: database: Database name models: Specific models to run full_refresh: Whether to do full refresh (default: false) store_timezone_offset_minutes: Timezone offset (default: "330") entrypoint: flows/clickstream/clickstream.py:clickstream_dbt_run parameters: database: "2427b5-28" full_refresh: false store_timezone_offset_minutes: "330" models: tag:clickstream is_complete_clickstream_run: true work_pool: name: local-work-pool work_queue_name: null job_variables: {} schedules: - interval: 1800.0 slug: byrtta-default-aggregation-schedule anchor_date: '2025-09-09T073000.000000+00:00' timezone: UTC active: false - cron: "0 0 * * 0" # Every Sunday at 00:00 UTC timezone: "UTC" slug: byrtta-daily-aggregation-schedule active: false parameters: run_daily: true when i am deploying the same the entry point of both the file is same i was just checking the methods to deploy, the thing is when i am deploying using python-prefect-sdk and in the prefect UI when i am triggering a quick run, this doesnt give me any popup of parameters which i could validate before running but when i am opening the deplyment deployed via prefect yaml for the same quick run it gives me the list of parameters as a dialogue box to validate or chnge why!?
m
thought for 231.1 seconds
Short answer: your SDK-created deployment is missing its parameter schema, so the UI can’t render the parameter form. The `prefect deploy`/prefect.yaml path auto-generates and uploads that schema from your flow function; the low-level client API does not unless you pass it explicitly. What’s going on - In Prefect 3.x the UI shows a parameter form only when the deployment has a non-empty
parameter_openapi_schema
(derived from your flow’s signature). If it’s empty, the UI can only “Quick run” with defaults and won’t show a dialog. - Deploying via prefect.yaml (
prefect deploy
) loads your entrypoint, introspects the flow, and saves
parameter_openapi_schema
for you. - Creating a deployment via
client.create_deployment(...)
does not compute that schema automatically. If you don’t pass it, it defaults to an empty object and the UI won’t show parameters. How to fix (SDK) Generate the schema from your entrypoint and pass it when creating the deployment:
Copy code
from prefect.utilities.callables import parameter_schema_from_entrypoint

entrypoint = template["entrypoint"]  # e.g. "flows/clickstream/clickstream.py:clickstream_dbt_run"
schema = parameter_schema_from_entrypoint(entrypoint)

deployment_id = self.client.create_deployment(
    flow_id=flow_id,
    name=deployment_name,
    tags=tags,
    parameters=parameters,                    # defaults shown/used by UI
    description=template["description"],
    entrypoint=entrypoint,
    work_pool_name=WORK_POOL_NAME,
    schedules=schedules,
    concurrency_limit=template.get("concurrency_limit"),
    parameter_openapi_schema=schema,          # <-- key bit
    pull_steps=[
        {
            "prefect.deployments.steps.git_clone": {
                "repository": GIT_REPO_URI,
                "branch": GIT_DEPLOYED_BRANCH_NAME,
                "access_token": "{{ prefect.blocks.secret.github-pat }}",
            }
        }
    ],
    # Optional: keep validation strict
    enforce_parameter_schema=True,
)
A couple of UI clarifications - Quick Run: immediately schedules a run with the deployment’s saved defaults; no prompt. - Run (custom): opens the parameter form if (and only if) the deployment has a parameter schema. If you’d prefer Prefect to handle all of this for you, another option is to use the high-level pattern in 3.x: -
flow.from_source(...).deploy(...)
automatically computes and attaches the parameter schema, just like
prefect deploy
. If you’re definitely clicking “Quick run” on both deployments and seeing a dialog for the yaml-created one, can you share a screenshot or confirm the UI button you’re using? By design, the dialog appears for the “Run” action; “Quick run” uses defaults without prompting.
k
@Marvin it gives me this error: { "detail": "[Step 1/3] Deployment creation failed: 1 validation error for DeploymentCreate\nparameter_openapi_schema\n Input should be a valid dictionary [type=dict_type, input_value=ParameterSchema(title='Pa...abase'], definitions={}), input_type=ParameterSchema]\n For further information visit https://errors.pydantic.dev/2.12/v/dict_type" } schema = parameter_schema_from_entrypoint(template["entrypoint"]) deployment_id = self.client.create_deployment( flow_id=flow_id, name=deployment_name, tags=tags, parameters=parameters, description=template["description"], entrypoint=template["entrypoint"], work_pool_name=WORK_POOL_NAME, schedules=schedules, concurrency_limit=template.get("concurrency_limit"), parameter_openapi_schema=schema, enforce_parameter_schema=True, pull_steps=[ { "prefect.deployments.steps.git_clone": { "repository": GIT_REPO_URI, "branch": GIT_DEPLOYED_BRANCH_NAME, "access_token": "{{ prefect.blocks.secret.github-pat }}", } } ], ) and this is how template is like CLICKSTREAM_TEMPLATE = { "name_template": "[{store_name}]: Clickstream Aggregation", "tags_template": ["clickstream-aggregation", "{store_slug}", "prod"], "description": ( "Responsible for Running Clickstream Lineage Models \n" "Args:\n" " database: Database name\n" " models: Specific models to run\n" " full_refresh: Whether to do full refresh (default: false)\n" " store_timezone_offset_minutes: Timezone offset" ), "entrypoint": "flows/clickstream/clickstream.py:clickstream_dbt_run", "parameters": { "full_refresh": False, "models": "tag:clickstream", "is_complete_clickstream_run": True, }, "concurrency_limit": 1, "schedules": [ { "type": "interval", "interval_seconds": 1800, "slug_template": "{store_slug}-default-aggregation-schedule", "active": False, }, { "type": "cron", "cron": "0 0 * * 0", # every Sunday midnight UTC "slug_template": "{store_slug}-daily-aggregation-schedule", "active": False, "parameters": {"run_daily": True}, }, ], }
m
thought for 38.6 seconds
Thanks for the details — the error tells us exactly what’s wrong: Input should be a valid dictionary … input_type=ParameterSchema You’re passing a ParameterSchema object to create_deployment, but Prefect’s API expects a plain dict for parameter_openapi_schema. Fix Convert the schema object to a dict before passing it:
Copy code
from prefect.utilities.callables import parameter_schema_from_entrypoint

entrypoint = template["entrypoint"]  # e.g. "flows/clickstream/clickstream.py:clickstream_dbt_run"
schema_obj = parameter_schema_from_entrypoint(entrypoint)
schema_dict = schema_obj.model_dump()  # or `schema_obj.dict()` if you're on older Pydantic

deployment_id = self.client.create_deployment(
    flow_id=flow_id,
    name=deployment_name,
    tags=tags,
    parameters=parameters,
    description=template["description"],
    entrypoint=entrypoint,
    work_pool_name=WORK_POOL_NAME,
    schedules=schedules,
    concurrency_limit=template.get("concurrency_limit"),
    parameter_openapi_schema=schema_dict,   # <-- must be a dict
    enforce_parameter_schema=True,
    pull_steps=[
        {
            "prefect.deployments.steps.git_clone": {
                "repository": GIT_REPO_URI,
                "branch": GIT_DEPLOYED_BRANCH_NAME,
                "access_token": "{{ prefect.blocks.secret.github-pat }}",
            }
        }
    ],
)
Notes - The UI shows the parameter form only if the deployment has a non-empty parameter_openapi_schema. Using the snippet above will populate it for SDK-created deployments (just like prefect deploy does from prefect.yaml). - “Quick run” uses saved defaults without prompting; “Run” (custom) opens the parameter form. After this change, you’ll see the form for your SDK-created deployment too. - Make sure the entrypoint module is importable where you run this code; the schema function imports your flow to inspect its signature.