geoHeil
07/19/2022, 4:34 PM/lib/python3.9/site-packages/dagster/core/workspace/context.py:554: UserWarning: Error loading repository location dagster.core.errors.DagsterInvalidMetadata: Could not resolve the metadata value for "key" to a known type. Its type was <class 'list'>. Consider wrapping the value with the appropriate MetadataValue type.
Stack Trace:
File "/lib/python3.9/site-packages/dagster/grpc/server.py", line 485, in _get_serialized_external_repository_data
external_repository_data_from_def(recon_repo.get_definition())
File "/lib/python3.9/site-packages/dagster/core/host_representation/external_data.py", line 791, in external_repository_data_from_def
external_asset_graph_data=external_asset_graph_from_defs(
File "/lib/python3.9/site-packages/dagster/core/host_representation/external_data.py", line 887, in external_asset_graph_from_defs
normalize_metadata(metadata=metadata_by_asset_key[asset_key], metadata_entries=[]),
File "/lib/python3.9/site-packages/dagster/core/definitions/metadata/__init__.py", line 100, in normalize_metadata
return [
File "/lib/python3.9/site-packages/dagster/core/definitions/metadata/__init__.py", line 101, in <listcomp>
package_metadata_value(k, v)
File "/lib/python3.9/site-packages/dagster/core/definitions/metadata/__init__.py", line 145, in package_metadata_value
raise DagsterInvalidMetadata(
jamie
07/19/2022, 4:42 PMgeoHeil
07/19/2022, 4:42 PMgeoHeil
07/19/2022, 4:43 PMowen
07/19/2022, 4:44 PMgeoHeil
07/19/2022, 4:44 PMowen
07/19/2022, 4:45 PMgeoHeil
07/19/2022, 4:45 PMgeoHeil
07/19/2022, 4:45 PMowen
07/19/2022, 4:45 PMowen
07/19/2022, 4:45 PMgeoHeil
07/19/2022, 4:56 PMgeoHeil
07/19/2022, 4:56 PMJordan
07/19/2022, 4:59 PMNone
type : https://dagster.slack.com/archives/C01U954MEER/p1657872953312049owen
07/19/2022, 5:05 PMowen
07/19/2022, 5:21 PMgeoHeil
07/19/2022, 5:23 PMallow_invalid
does this mean I should define the metadata in a different way?owen
07/19/2022, 5:32 PMallow_invalid
is set to True or False), dagster will try to convert each element of a metadata dictionary to a MetadataValue()
instance. For example, if you have {"a": 1}
as your metadata, this will get converted to {"a": <http://MetadataValue.int|MetadataValue.int>(1)}
. This normalization applies to a bunch of different standard classes like strings, bools, dictionaries, etc. It happens that the two specific data types you both are running into issues with (None
and List
) are not handled by this automatic conversion, although it's possible that they should be.geoHeil
07/19/2022, 5:33 PMowen
07/19/2022, 5:36 PMmetadata={"label1": value1, "label2":value2}
format for your metadata, as I believe we're deprecating the metadata_entries=[MetadataEntry.foo(value1, "label1")]
format in 1.0.0
.owen
07/19/2022, 5:38 PMgeoHeil
07/19/2022, 5:40 PMowen
07/19/2022, 5:40 PM{"md_label": MetadataValue.md("metadata string here")}
geoHeil
07/19/2022, 8:34 PMowen
07/19/2022, 8:35 PMCould not resolve the metadata value for "key" to a known type. Its type was <class 'list'>
)owen
07/19/2022, 8:35 PMgeoHeil
07/19/2022, 8:36 PMyield <http://MetadataEntry.int|MetadataEntry.int>(value=row_count, label="row_count")
of these snippets. - but they do not contain a listgeoHeil
07/19/2022, 8:36 PMgeoHeil
07/19/2022, 8:37 PMowen
07/19/2022, 8:39 PMgeoHeil
07/19/2022, 9:00 PMgeoHeil
07/19/2022, 9:01 PMgeoHeil
07/19/2022, 9:02 PMgeoHeil
07/19/2022, 9:02 PMowen
07/19/2022, 9:11 PMmetadata={"foo": {"list": ["foo"]}, "bar": {"list": [SOME_VARIABLE]}}
, then just accessing metadata["foo"]["list"] instead of metadata["foo"]. Dagster can automatically convert dictionaries into metadata values, while it can't do the same for lists.geoHeil
07/19/2022, 9:25 PMowen
07/19/2022, 9:27 PMgeoHeil
07/21/2022, 5:29 AMgeoHeil
07/21/2022, 5:29 AMgeoHeil
07/21/2022, 5:32 AMtext
datatype column. As a result the IO manager needs to 1) write to postgres 2) fixup the datatype to jsonb
by executing some sql statements. However, most assets which are materialized by the IO manager do not need this treatment. I was thinking about enabling a generic higher order cleanup function in case other assets need special treatment as well in the future.geoHeil
07/21/2022, 12:08 PMgeoHeil
07/21/2022, 1:40 PMgeoHeil
07/21/2022, 1:51 PMOutput
object of the MultiAsset
. There, I needed to move back to MetadataValue
style notation of the metadata. Didn`t you tell me that this is meant to be obsolete? What are your plans for the future? And why does it sound like input definition and output metadata could be potentially inconsistent?owen
07/21/2022, 4:41 PMmetadata_entries
argument accepts a list (this will be deprecated), while the metadata
argument accepts a dictionary (this is the recommend argument going forward). I think changing the argument name should resolve the issue you're seeingowen
07/21/2022, 4:42 PMgeoHeil
07/21/2022, 4:43 PMOutput
. Let me swap this back to dict then.owen
07/21/2022, 4:48 PM{"fixup_type": "jsonb"}
, then the IOManager reads the fixup_type
value to execute one of a few possible cleanup functions).