Skip to content

Commit 4284fc6

Browse files
authored
Merge pull request #2834 from VOLTTRON/releases/8.1.2
Release of hotfix version 8.1.2 of VOLTTRON
2 parents 97514d8 + c97e1b0 commit 4284fc6

File tree

10 files changed

+73
-7
lines changed

10 files changed

+73
-7
lines changed

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ def __getattr__(cls, name):
4343
author = 'The VOLTTRON Community'
4444

4545
# The short X.Y version
46-
version = '8.1.1'
46+
version = '8.1.2'
4747
# The full version, including alpha/beta/rc tags
48-
release = '8.1.1'
48+
release = '8.1.2'
4949

5050

5151
# -- General configuration ---------------------------------------------------

volttron/platform/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
from urllib.parse import urlparse
5050

5151
from ..utils.frozendict import FrozenDict
52-
__version__ = '8.1.1'
52+
__version__ = '8.1.2'
5353

5454
_log = logging.getLogger(__name__)
5555

volttron/platform/dbutils/mysqlfuncts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ def get_topic_meta_map(self):
414414
_log.debug("loading metadata from db")
415415
topic_meta_map = dict()
416416
for id, meta in rows:
417-
topic_meta_map[id] = jsonapi.loads(meta)
417+
topic_meta_map[id] = jsonapi.loads(meta) if meta else None
418418
return topic_meta_map
419419

420420
def get_topic_map(self):

volttron/platform/dbutils/postgresqlfuncts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def get_topic_meta_map(self):
350350
'SELECT topic_id, metadata '
351351
'FROM {}').format(Identifier(self.meta_table))
352352
rows = self.select(query)
353-
meta_map = {tid: jsonapi.loads(meta) for tid, meta in rows}
353+
meta_map = {tid: jsonapi.loads(meta) if meta else None for tid, meta in rows}
354354
return meta_map
355355

356356
def get_agg_topics(self):

volttron/platform/dbutils/redshiftfuncts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def get_topic_meta_map(self):
266266
'SELECT topic_id, metadata '
267267
'FROM {}').format(Identifier(self.meta_table))
268268
rows = self.select(query)
269-
meta_map = {tid: jsonapi.loads(meta) for tid, meta in rows}
269+
meta_map = {tid: jsonapi.loads(meta) if meta else None for tid, meta in rows}
270270
return meta_map
271271

272272
def get_agg_topics(self):

volttron/platform/dbutils/sqlitefuncts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ def get_topic_meta_map(self):
384384
_log.debug("loading metadata from db")
385385
topic_meta_map = dict()
386386
for id, meta in rows:
387-
topic_meta_map[id] = jsonapi.loads(meta)
387+
topic_meta_map[id] = jsonapi.loads(meta) if meta else None
388388
return topic_meta_map
389389

390390
def get_agg_topics(self):

volttrontesting/platform/dbutils/test_mysqlfuncts.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,23 @@ def test_get_topic_map_should_succeed(get_container_func):
263263
assert actual == expected
264264

265265

266+
def test_get_topic_meta_map_should_succeed(get_container_func):
267+
container, sqlfuncts, connection_port, historian_version = get_container_func
268+
if historian_version == "<4.0.0":
269+
pytest.skip("method applied only to version >=4.0.0")
270+
else:
271+
query = """
272+
INSERT INTO topics (topic_name)
273+
VALUES ('football');
274+
INSERT INTO topics (topic_name, metadata)
275+
VALUES ('baseball', '{"metadata":"value"}');
276+
"""
277+
seed_database(container, query)
278+
expected = {1: None, 2: {"metadata": "value"}}
279+
actual = sqlfuncts.get_topic_meta_map()
280+
assert actual == expected
281+
282+
266283
# fails for image:mysql:8.0.25 historian schema version >=4.0.0
267284
def test_get_agg_topic_map_should_return_dict(get_container_func):
268285
container, sqlfuncts, connection_port, historian_version = get_container_func

volttrontesting/platform/dbutils/test_postgresql_timescaledb.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,22 @@ def test_get_topic_map_should_return_maps(get_container_func):
331331
assert actual == expected
332332

333333

334+
def test_get_topic_meta_map_should_return_maps(get_container_func):
335+
container, sqlfuncts, connection_port, historian_version = get_container_func
336+
if historian_version == "<4.0.0":
337+
pytest.skip("method applied only to version >=4.0.0")
338+
else:
339+
query = """
340+
INSERT INTO topics (topic_name)
341+
VALUES ('football');
342+
INSERT INTO topics (topic_name, metadata)
343+
VALUES ('baseball', '{"meta":"value"}');
344+
"""
345+
seed_database(container, query)
346+
expected = {1: None, 2: {"meta": "value"}}
347+
actual = sqlfuncts.get_topic_meta_map()
348+
assert actual == expected
349+
334350
def test_get_agg_topics_should_return_list(get_container_func):
335351
container, postgresqlfuncts, port_on_host, historian_version = get_container_func
336352
topic = "some_agg_topic"

volttrontesting/platform/dbutils/test_postgresqlfuncts.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,23 @@ def test_get_topic_map_should_return_maps(get_container_func):
338338
assert actual == expected
339339

340340

341+
def test_get_topic_meta_map_should_return_maps(get_container_func):
342+
container, sqlfuncts, connection_port, historian_version = get_container_func
343+
if historian_version == "<4.0.0":
344+
pytest.skip("method applied only to version >=4.0.0")
345+
else:
346+
query = """
347+
INSERT INTO topics (topic_name)
348+
VALUES ('football');
349+
INSERT INTO topics (topic_name, metadata)
350+
VALUES ('baseball', '{"meta":"value"}');
351+
"""
352+
seed_database(container, query)
353+
expected = {1: None, 2: {"meta": "value"}}
354+
actual = sqlfuncts.get_topic_meta_map()
355+
assert actual == expected
356+
357+
341358
def test_get_agg_topics_should_return_list(get_container_func):
342359
container, sqlfuncts, connection_port, historian_version = get_container_func
343360

volttrontesting/platform/dbutils/test_sqlitefuncts.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,22 @@ def test_get_topic_map(get_sqlitefuncts):
276276
assert actual_topic_map == expected_topic_map
277277

278278

279+
@pytest.mark.sqlitefuncts
280+
@pytest.mark.dbutils
281+
def test_get_topic_meta_map(get_sqlitefuncts):
282+
sqlitefuncts, historian_version = get_sqlitefuncts
283+
if historian_version == "<4.0.0":
284+
pytest.skip("method applied only to version >=4.0.0")
285+
else:
286+
query = "INSERT INTO topics (topic_name) values ('football');" \
287+
"INSERT INTO topics (topic_name, metadata) values ('netball', '{\"meta\":\"value\"}');"
288+
query_db(query)
289+
expected_topic_map = {1: None, 2: {"meta": "value"}}
290+
291+
actual_topic_meta_map = sqlitefuncts.get_topic_meta_map()
292+
293+
assert actual_topic_meta_map == expected_topic_map
294+
279295
@pytest.mark.sqlitefuncts
280296
@pytest.mark.dbutils
281297
def test_get_agg_topics(get_sqlitefuncts):

0 commit comments

Comments
 (0)