Skip to content

Commit

Permalink
Return primaryKey for vertex/edge property (#2001)
Browse files Browse the repository at this point in the history
  • Loading branch information
lidongze0629 committed Sep 5, 2022
1 parent 7f389be commit be07087
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
1 change: 1 addition & 0 deletions python/graphscope/framework/graph_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def to_dict(self) -> dict:
"name": self.name,
"id": self.id,
"type": graph_def_pb2.DataTypePb.Name(self.data_type),
"is_primary_key": self.is_primary_key,
}


Expand Down
25 changes: 20 additions & 5 deletions python/graphscope/tests/unittest/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,33 @@ def test_graph_schema_todict(p2p_property_graph):
{
"label": "person",
"properties": [
{"name": "weight", "id": 0, "type": "LONG"},
{"name": "id", "id": 1, "type": "LONG"},
{
"name": "weight",
"id": 0,
"type": "LONG",
"is_primary_key": False,
},
{"name": "id", "id": 1, "type": "LONG", "is_primary_key": False},
],
}
],
"edges": [
{
"label": "knows",
"properties": [
{"name": "src_label_id", "id": 0, "type": "LONG"},
{"name": "dst_label_id", "id": 1, "type": "LONG"},
{"name": "dist", "id": 2, "type": "LONG"},
{
"name": "src_label_id",
"id": 0,
"type": "LONG",
"is_primary_key": False,
},
{
"name": "dst_label_id",
"id": 1,
"type": "LONG",
"is_primary_key": False,
},
{"name": "dist", "id": 2, "type": "LONG", "is_primary_key": False},
],
"relations": [{"src_label": "person", "dst_label": "person"}],
}
Expand Down

0 comments on commit be07087

Please sign in to comment.