https://dagster.io/ logo
#ask-community
Title
# ask-community
s

Shaounak Nasikkar

03/21/2022, 10:02 PM
Hi Team, Facing the following issue with version 0.14.5. File "/home/codeserver/projects/XXXXX/Scripts/Util/dagster/app/ops/teardown_ops.py", line 15, in <module> "connection_dict": In(dagster_type=Dict, description="Connection Dictionary"), File "/home/codeserver/.local/share/virtualenvs/dagster-bFs17taf/lib/python3.9/site-packages/dagster/core/definitions/input.py", line 399, in new dagster_type=check.opt_inst_param(dagster_type, "dagster_type", (type, DagsterType)), The ins are defined the way they are documented, not sure why the error is occurring - Here is the code -
Copy code
@op(
    config_schema={"extn": str},
    ins={
        "connection_dict": In(dagster_type=Dict, description="Connection Dictionary"),
        "ready": In(dagster_type=List[Any], description="Ready", default_value=[]),
    },
)
j

jamie

03/22/2022, 1:41 PM
Hi @Shaounak Nasikkar! when you specify a
Dict
you have to state the type for the keys and values as well. For example
Dict[Any, Any]
or
Dict[String, Int]
Can you point me to the page in the docs you were looking at so I can add some clarification?
e

Egor -

03/23/2022, 11:45 PM
Hi @jamie I see in the docs it’s still
Copy code
ins={'spec': In(Dict)},
https://docs.dagster.io/_apidocs/types#dagster.Dict
thank you box 1
👍 1
s

Shaounak Nasikkar

03/24/2022, 6:08 PM
I had updated it as per recommendation but now started facing another issue for the "Any" datatype - /home/codeserver/.local/share/virtualenvs/dagster-bFs17taf/lib/python3.9/site-packages/dagster/core/workspace/context.py558 UserWarning: Error loading repository location repo_data_modeling.pydagster.check.ParameterCheckError Param "dagster_type" is not one of ['DagsterType', 'type']. Got typing.Any which is type <class 'typing._SpecialForm'>.
Copy code
from dagster import op, InputDefinition, Dict, List, Any
@op(
    ins={
        "src_pd_df": In(Any, description="Source Pandas Dataframe"),
        "tgt_pd_df": In(Any, description="Target Pandas Dataframe"),
    }
)
I was using "Any" from typing module before. I'm not using it anymore. As you see, I'm using it from dagster.
e

Egor -

03/24/2022, 6:10 PM
do import Any
Copy code
from dagster import Any
👍 1
s

Shaounak Nasikkar

03/24/2022, 6:12 PM
That's what am doing. Updated the thread above.
Am not using typings anywhere in my code.
Finally we removed using Any as I don't know how but it was kept on importing Any from typing while I wasn't importing any module from typing. At any place we were using Any we changed it to either Dict[str, Any] or List[Any] or for the issue above we changed it to use pandas DataFrame as input -
Copy code
from pandas import DataFrame as pandas_dataframe
@op(
    ins={
        "src_pd_df": In(pandas_dataframe, description="Source Pandas Dataframe"),
        "tgt_pd_df": In(pandas_dataframe, description="Target Pandas Dataframe"),
    }
)
3 Views