@@ -42,7 +42,7 @@ def delete_relationship_if_exists(client, schema_name):
4242 """Delete a relationship by schema name if it exists."""
4343 rel = client .tables .get_relationship (schema_name )
4444 if rel :
45- rel_id = rel .get ( "MetadataId" )
45+ rel_id = rel .relationship_id
4646 if rel_id :
4747 client .tables .delete_relationship (rel_id )
4848 print (f" (Cleaned up existing relationship: { schema_name } )" )
@@ -236,11 +236,11 @@ def _run_example(client):
236236 )
237237 )
238238
239- print (f"[OK] Created relationship: { result [ ' relationship_schema_name' ] } " )
240- print (f" Lookup field: { result [ ' lookup_schema_name' ] } " )
241- print (f" Relationship ID: { result [ ' relationship_id' ] } " )
239+ print (f"[OK] Created relationship: { result . relationship_schema_name } " )
240+ print (f" Lookup field: { result . lookup_schema_name } " )
241+ print (f" Relationship ID: { result . relationship_id } " )
242242
243- rel_id_1 = result [ " relationship_id" ]
243+ rel_id_1 = result . relationship_id
244244
245245 # ============================================================================
246246 # 5. CREATE LOOKUP FIELD (Convenience Method)
@@ -265,10 +265,10 @@ def _run_example(client):
265265 )
266266 )
267267
268- print (f"[OK] Created lookup using convenience method: { result2 [ ' lookup_schema_name' ] } " )
269- print (f" Relationship: { result2 [ ' relationship_schema_name' ] } " )
268+ print (f"[OK] Created lookup using convenience method: { result2 . lookup_schema_name } " )
269+ print (f" Relationship: { result2 . relationship_schema_name } " )
270270
271- rel_id_2 = result2 [ " relationship_id" ]
271+ rel_id_2 = result2 . relationship_id
272272
273273 # ============================================================================
274274 # 6. CREATE MANY-TO-MANY RELATIONSHIP
@@ -292,10 +292,10 @@ def _run_example(client):
292292 )
293293 )
294294
295- print (f"[OK] Created M:N relationship: { result3 [ ' relationship_schema_name' ] } " )
296- print (f" Relationship ID: { result3 [ ' relationship_id' ] } " )
295+ print (f"[OK] Created M:N relationship: { result3 . relationship_schema_name } " )
296+ print (f" Relationship ID: { result3 . relationship_id } " )
297297
298- rel_id_3 = result3 [ " relationship_id" ]
298+ rel_id_3 = result3 . relationship_id
299299
300300 # ============================================================================
301301 # 7. QUERY RELATIONSHIP METADATA
@@ -308,21 +308,21 @@ def _run_example(client):
308308
309309 rel_metadata = client .tables .get_relationship ("new_Department_Employee" )
310310 if rel_metadata :
311- print (f"[OK] Found relationship: { rel_metadata .get ( 'SchemaName' ) } " )
312- print (f" Type: { rel_metadata .get ( '@odata.type' ) } " )
313- print (f" Referenced Entity: { rel_metadata .get ( 'ReferencedEntity' ) } " )
314- print (f" Referencing Entity: { rel_metadata .get ( 'ReferencingEntity' ) } " )
311+ print (f"[OK] Found relationship: { rel_metadata .relationship_schema_name } " )
312+ print (f" Type: { rel_metadata .relationship_type } " )
313+ print (f" Referenced Entity: { rel_metadata .referenced_entity } " )
314+ print (f" Referencing Entity: { rel_metadata .referencing_entity } " )
315315 else :
316316 print (" Relationship not found" )
317317
318318 log_call ("Retrieving M:N relationship by schema name" )
319319
320320 m2m_metadata = client .tables .get_relationship ("new_employee_project" )
321321 if m2m_metadata :
322- print (f"[OK] Found relationship: { m2m_metadata .get ( 'SchemaName' ) } " )
323- print (f" Type: { m2m_metadata .get ( '@odata.type' ) } " )
324- print (f" Entity 1: { m2m_metadata .get ( 'Entity1LogicalName' ) } " )
325- print (f" Entity 2: { m2m_metadata .get ( 'Entity2LogicalName' ) } " )
322+ print (f"[OK] Found relationship: { m2m_metadata .relationship_schema_name } " )
323+ print (f" Type: { m2m_metadata .relationship_type } " )
324+ print (f" Entity 1: { m2m_metadata .entity1_logical_name } " )
325+ print (f" Entity 2: { m2m_metadata .entity2_logical_name } " )
326326 else :
327327 print (" Relationship not found" )
328328
0 commit comments