Hi all! I'm having some issues with passing a dict...
# ask-community
a
Hi all! I'm having some issues with passing a dictionary parameter to my deployment. The order of dict keys is changed after deploying it (different in the UI and in a python file). Unfortunately, this causes issues in the next code execution steps. Have you happened to encounter this problem before or do you know how to fix it? @Marvin do you know something?
m
It appears that the issue with the dictionary parameter order changing after deployment is related to how dictionaries are handled and stored in Prefect. Here's a summary of the findings: 1. Parameter Schema Order: A GitHub PR (https://github.com/PrefectHQ/prefect/pull/8013) dates that PostgreSQL JSONB storage does not preserve the order of dictionary keys. The new approach includes adding a position key to each parameter in the OpenAPI schema, which can be used by the frontend to reconstruct the original order. - Example:
{ "title": "foo", "position": 0 }
,
{ "title": "bar", "position": 1 }
2. Editing Deployments: In the Prefect documentation, you can edit default parameters for deployments in the Prefect UI. This change can ensure the new values are utilized properly (https://docs.prefect.io/latest/concepts/deployments-block-based/). For a fix: - Ensure you are using the latest version of Prefect. You can check the latest version using the CLI or the Prefect documentation. - Verify if the frontend is reconstructing the parameter order correctly using the position keys included in the
parameter_openapi_schema
. To dive deeper, you might want to explore the following resources: - Prefect Deployment Guide - Relevant GitHub PR: Add position key to parameter openapi schema properties Hopefully, these references will help you manage parameter order more effectively in your deployments.