https://prefect.io logo
Title
t

Tomás Emilio Silva Ebensperger

09/12/2022, 8:03 PM
When I set up parameters for a Deployment in the UI, I specify one of the parameters as type dict, for some reason the UI is saying it is an object and it treats it as a json instead. I can always load the json into a dict in the code, but I was wondering if I am doing something wrong.
1
z

Zanie

09/12/2022, 8:09 PM
We should automatically be coercing the JSON to a dictionary at runtime for you, is this not happening?
t

Tomás Emilio Silva Ebensperger

09/12/2022, 8:10 PM
no
z

Zanie

09/12/2022, 8:11 PM
Could you share a short example that prints the value of the parameter at runtime and includes the value you’ve set via the UI? We’ve got some WIP for improving the UI import forms here as well.
You can also check the schema that will get generated for your flow function:
from prefect.utilities.callables import parameter_schema

parameter_schema(my_flow)
t

Tomás Emilio Silva Ebensperger

09/12/2022, 8:14 PM
@flow
def run(
	sf_session_id: str=None,
	db_config: dict=None,
	sobjects: str or list=None,
	method_: str='run',
	run_local: bool=False,
	# *args, 
	# **kwargs,
):
title='Parameters' type='object' properties={'sf_session_id': {'title': 'sf_session_id', 'type': 'string'}, 'db_config': {'title': 'db_config', 'type': '
object'}, 'sobjects': {'title': 'sobjects', 'type': 'string'}, 'method_': {'title': 'method_', 'default': 'run', 'type': 'string'}, 'run_local': {'title'
: 'run_local', 'default': False, 'type': 'boolean'}} required=None definitions=None
it says is is an object
which "jsonifies" the dict i put in the UI
- db_config: value is not a valid dict
z

Zanie

09/12/2022, 8:21 PM
It needs to be sent as JSON, this actually looks like a client side bug in that it should parse this but doesn't try to. I'll open an issue. Thanks for reporting this!
t

Tomás Emilio Silva Ebensperger

09/12/2022, 8:21 PM
Np, thanks!
Hi Michael, any updates on this bug?