VOLTTRON / volttron

VOLTTRON Distributed Control System Platform
https://volttron.readthedocs.io/
Other
454 stars 216 forks source link

caching metadata on SQLhistorian start fails when metadata contains NULL #2821

Open schandrika opened 2 years ago

schandrika commented 2 years ago

caching metadata on SQLhistorian start fails when metadata contains NULL Affected versions- volttron 8.x and develop

bbartling commented 2 years ago

We are running into this issue when we updated our Central instance to version 8, same thing? Here's a snip from the log file:

2022-05-20 23:51:07,648 (sqlhistorianagent-4.0.0 1993611) volttron.platform.agent.base_historian INFO: Trying to setup historian
2022-05-20 23:51:07,648 (sqlhistorianagent-4.0.0 1993611) __main__ INFO: historian_setup on Thread: Thread-1
2022-05-20 23:51:07,701 (sqlhistorianagent-4.0.0 1993611) volttron.platform.agent.base_historian ERROR: Failed to setup historian!
Traceback (most recent call last):
  File "/var/lib/volttron/volttron/platform/agent/base_historian.py", line 1292, in _historian_setup
    self.historian_setup()
  File "/var/lib/volttron/volttron/utils/docs.py", line 47, in f
    return self.mthd(obj, *args, **kwargs)
  File "/home/volttron/.volttron/agents/06de9128-a5a8-41eb-ac7c-1e7821653ea8/sqlhistorianagent-4.0.0/sqlhistorian/historian.py", line 352, in historian_setup
    topic_meta_map = self.bg_thread_dbutils.get_topic_meta_map()
  File "/var/lib/volttron/volttron/platform/dbutils/postgresqlfuncts.py", line 352, in get_topic_meta_map
    rows = self.select(query)
  File "/var/lib/volttron/volttron/platform/dbutils/basedb.py", line 436, in select
    cursor.execute(query, args)
psycopg2.errors.UndefinedColumn: column "metadata" does not exist
LINE 1: SELECT topic_id, metadata FROM "topics"