goblin-ogm / goblin

Goblin OGM on top of TinkerPop 3
http://goblin-ogm.com
Apache License 2.0
11 stars 2 forks source link

KeyError: <T.label: 4> when session.save_edge() call to JanusGraph #4

Open Phocion opened 3 years ago

Phocion commented 3 years ago

Hi all,

Having an issue with Goblin 2.2.3 and JanusGraph 0.5.3. The following stacktrace below shows the exception when calling the session.save_edge() function to add a new edge to the graph.

Not even sure what "<T.label: 4>" is referencing here, but it's the same for every edge added to the graph.

However the edges are all in fact present on the server as you could expect. So they are properly written to JanusGraph. Just want to make sure there's not some bigger issue underlying this, as I have not experienced this issue with JanusGraph 0.3 and older versions of Goblin in the past.

I'm only experiencing this with session.save_edge(...) and not session.save_vertex(...).

2021-05-09 22:26:12,463: INFO @ log - write :: Adding remote edge: SOURCE (T.id=438456)      --interacts_with--      TARGET (T.id=4240)
2021-05-09 22:26:12,493: ERROR @ write - <kg.models.Edges.Interacts_With object at 0x7f1e7fdc5e10>
Traceback (most recent call last):
  File "/home/tjs/bitbucket/bs_kg_loader/bs/kg/gremlin.py", line 145, in write
    await session.save_edge(elem)
  File "/apps/pkgs/foss/python.org/Python/3.6.4_64/lib/python3.6/asyncio/coroutines.py", line 110, in __next__
    return self.gen.send(None)
  File "/home/tjs/venv/bskg_v2/lib/python3.6/site-packages/goblin/session.py", line 363, in save_edge
    self._add_edge, self._update_edge)
  File "/apps/pkgs/foss/python.org/Python/3.6.4_64/lib/python3.6/asyncio/coroutines.py", line 110, in __next__
    return self.gen.send(None)
  File "/home/tjs/venv/bskg_v2/lib/python3.6/site-packages/goblin/session.py", line 471, in _save_element
    result = await self.__handle_create_func(elem, create_func)
  File "/apps/pkgs/foss/python.org/Python/3.6.4_64/lib/python3.6/asyncio/coroutines.py", line 110, in __next__
    return self.gen.send(None)
  File "/home/tjs/venv/bskg_v2/lib/python3.6/site-packages/goblin/session.py", line 464, in __handle_create_func
    return await create_func(elem)
  File "/apps/pkgs/foss/python.org/Python/3.6.4_64/lib/python3.6/asyncio/coroutines.py", line 110, in __next__
    return self.gen.send(None)
  File "/home/tjs/venv/bskg_v2/lib/python3.6/site-packages/goblin/session.py", line 491, in _add_edge
    return await self._add_properties(traversal, props, edge)
  File "/apps/pkgs/foss/python.org/Python/3.6.4_64/lib/python3.6/asyncio/coroutines.py", line 110, in __next__
    return self.gen.send(None)
  File "/home/tjs/venv/bskg_v2/lib/python3.6/site-packages/goblin/session.py", line 544, in _add_properties
    return await self._simple_traversal(traversal, elem)
  File "/apps/pkgs/foss/python.org/Python/3.6.4_64/lib/python3.6/asyncio/coroutines.py", line 110, in __next__
    return self.gen.send(None)
  File "/home/tjs/venv/bskg_v2/lib/python3.6/site-packages/goblin/session.py", line 445, in _simple_traversal
    elem = element.__mapping__.mapper_func(elem, props, element)
  File "/home/tjs/venv/bskg_v2/lib/python3.6/site-packages/goblin/mapper.py", line 136, in map_edge_to_ogm
    label = props.pop(T.label)
KeyError: <T.label: 4>

My edge model looks like the following:

class Interacts_With(Edge):
    evidencetype = Property(String, default='')
    evidencesource = Property(String, default='')
    weight = Property(Float, default=0.0)
    e_source = Property(String, default='')
    e_datecreated = Property(Integer, default=0)
    e_datemodified = Property(Integer, default=0)
    e_creator = Property(String, default='')
    e_flag = Property(Integer, default=0)
    e_dl_ver = Property(String, default='')

Thank you!