@@ -125,8 +125,6 @@ def _create_single(self, entity_set: str, record: Dict[str, Any]) -> str:
125125 f"Create response missing GUID in OData-EntityId/Location headers (status={ getattr (r ,'status_code' , '?' )} ). Headers: { header_keys } "
126126 )
127127
128- # Removed _logical_from_entity_set: public surface now exclusively uses logical names.
129-
130128 def _create_multiple (self , entity_set : str , logical_name : str , records : List [Dict [str , Any ]]) -> List [str ]:
131129 if not all (isinstance (r , dict ) for r in records ):
132130 raise TypeError ("All items for multi-create must be dicts" )
@@ -174,14 +172,18 @@ def _create_multiple(self, entity_set: str, logical_name: str, records: List[Dic
174172
175173 # --- Derived helpers for high-level client ergonomics ---
176174 def _primary_id_attr (self , logical_name : str ) -> str :
177- """Return primary key attribute using metadata (fallback to <logical_name>id) ."""
175+ """Return primary key attribute using metadata; error if unavailable ."""
178176 pid = self ._logical_primaryid_cache .get (logical_name )
179177 if pid :
180178 return pid
181- # Resolve metadata (populates _logical_primaryid_cache)
179+ # Resolve metadata (populates _logical_primaryid_cache or raises if logical unknown )
182180 self ._entity_set_from_logical (logical_name )
183181 pid2 = self ._logical_primaryid_cache .get (logical_name )
184- return pid2 or f"{ logical_name } id"
182+ if pid2 :
183+ return pid2
184+ raise RuntimeError (
185+ f"PrimaryIdAttribute not resolved for logical name '{ logical_name } '. Metadata did not include PrimaryIdAttribute."
186+ )
185187
186188 def _update_by_ids (self , logical_name : str , ids : List [str ], changes : Union [Dict [str , Any ], List [Dict [str , Any ]]]) -> None :
187189 """Update many records by GUID list using UpdateMultiple under the hood.
@@ -518,10 +520,6 @@ def _entity_set_from_logical(self, logical: str) -> str:
518520 """
519521 if not logical :
520522 raise ValueError ("logical name required" )
521- # Heuristic: warn if caller passed a plural (common mistake after logical_name pivot)
522- if logical .endswith ("s" ) and not logical .endswith ("ss" ):
523- # Soft validation: if lookup fails we will raise a descriptive error below.
524- pass
525523 cached = self ._logical_to_entityset_cache .get (logical )
526524 if cached :
527525 return cached
@@ -582,7 +580,6 @@ def _get_entity_by_schema(self, schema_name: str) -> Optional[Dict[str, Any]]:
582580 items = r .json ().get ("value" , [])
583581 return items [0 ] if items else None
584582
585-
586583 def _create_entity (self , schema_name : str , display_name : str , attributes : List [Dict [str , Any ]]) -> str :
587584 url = f"{ self .api } /EntityDefinitions"
588585 payload = {
0 commit comments