@@ -668,7 +668,7 @@ def test_convert_schema():
668668 ]
669669
670670 assert len (result ["labels" ]) == 2
671- labels = {l ["name" ]: l for l in result ["labels" ]}
671+ labels = {label ["name" ]: label for label in result ["labels" ]}
672672 assert "Person" in labels
673673 assert "name" in labels ["Person" ]["propertyDeclarationNames" ]
674674 assert "KNOWS" in labels
@@ -696,3 +696,42 @@ def test_convert_schema_empty():
696696 assert result ["edgeTables" ] == []
697697 assert result ["labels" ] == []
698698 assert result ["propertyDeclarations" ] == []
699+
700+
701+ def test_convert_schema_shared_label ():
702+ """Test _convert_schema where multiple tables share the same label."""
703+ input_schema = {
704+ "propertyGraphReference" : {"propertyGraphId" : "SharedLabelGraph" },
705+ "nodeTables" : [
706+ {
707+ "name" : "PersonA" ,
708+ "dataSourceTable" : {"tableId" : "TableA" },
709+ "labelAndProperties" : [
710+ {
711+ "label" : "Person" ,
712+ "properties" : [{"name" : "id" , "dataType" : {"typeKind" : "INT64" }, "expression" : "id" }],
713+ }
714+ ],
715+ },
716+ {
717+ "name" : "PersonB" ,
718+ "dataSourceTable" : {"tableId" : "TableB" },
719+ "labelAndProperties" : [
720+ {
721+ "label" : "Person" ,
722+ "properties" : [{"name" : "name" , "dataType" : {"typeKind" : "STRING" }, "expression" : "name" }],
723+ }
724+ ],
725+ }
726+ ],
727+ "edgeTables" : [],
728+ }
729+
730+ schema_json = json .dumps (input_schema )
731+ result_json = graph_server ._convert_schema (schema_json )
732+ result = json .loads (result_json )
733+
734+ # Verify that the 'Person' label includes properties from both tables
735+ labels = {l ["name" ]: l for l in result ["labels" ]}
736+ assert "Person" in labels
737+ assert set (labels ["Person" ]["propertyDeclarationNames" ]) == {"id" , "name" }
0 commit comments