Open craig8 opened 2 years ago
@schandrika thoughts? @ntenney this fits with our issue.
Instead of meta_map = {tid: jsonapi.loads(meta) if meta else None for tid, meta in rows}
if meta and isinstance(meta, str): jsonload elif isinstance(meta, dict) do dict map else meta = None
I like checking isinstance than the alternate solution of forcing jsonb.
This is from @ntenney that we are using in our deployment.
meta_map = {tid: meta if meta and type(meta) == dict else jsonapi.loads(meta) if meta else None for tid, meta in rows}
Is your feature request related to a problem? Please describe. I changed my local database to use jsonb for the metadata column in the topics table. When the agent starts up for the first time everything is fine, however on subsequent starts the agent fails to start due to jsonb returning a dictionary rather than the text for the metadata.
As seen in the following stack trace.
Describe the solution you'd like I think it would be easily handled in the current code structure by determining if the passed column is a dictionary or not before attempting to load it.
Describe alternatives you've considered Remove all of the text and go with jsonb for all