https://dagster.io/ logo
Title
r

Rubén Lopez Lozoya

07/12/2021, 10:36 AM
Hi all, I'm currently using Dagster 0.11.14 (had to pin this version because I was getting errors about unconnected inputs when upgrading to v0.11.15) and I am getting this error when passing a list of columns to a solid as part of the solid config:
TypeError: Argument 'obj' has incorrect type (expected list, got frozenlist)
This is what my config looks like:
solid_uw_get_target_metrics_columns = configured(
    solid_get_target_df_columns, name="solid_uw_get_target_metrics_columns"
)({"columns": ["field", "source", "value", "reliability"]})
And this is what the solid looks like:
@solid(
    config_schema={
        "columns": Field([str], is_required=True),
    }
)
def solid_get_target_df_columns(context, dfs: Dict[str, DagsterDataFrame]):
    """Solid that returns a Dictionary where every DataFrame has the columns specified from the original DataFrame

    Parameters:
    ---------
    dfs : Dict[str, DagsterDataFrame]
        Dictionary containing DagsterDataFrames to retrieve columns from
    columns : List[str]
        List of target columns

    Returns:
    -------
        dfs: Dict[str, DagsterDataFrame]
            Dictionary containing DagsterDataFrames with target columns
    """
    processed_dfs = {}
    for key, df in dfs.items():
        processed_dfs[key] = df[context.solid_config["columns"]]

    return processed_dfs
If I cast to
list(context.solid_config["columns"])
it works, otherwise the error will keep appearing. Any ideas?
a

alex

07/12/2021, 3:56 PM
yeah we “freeze” the mutable types (dict, list) in the config tree to prevent accidental mutation. This does appear to have the unfortunate side effect of causing problems when the values are used with libraries that have explicit type checks. casting to
list
is the right thing to do for now, but consider voicing your opinion on https://github.com/dagster-io/dagster/issues/3008
1