@@ -112,8 +112,6 @@ def _create_single(self, entity_set: str, record: Dict[str, Any]) -> str:
112112 f"Create response missing GUID in OData-EntityId/Location headers (status={ getattr (r ,'status_code' , '?' )} ). Headers: { header_keys } "
113113 )
114114
115- # Removed _logical_from_entity_set: public surface now exclusively uses logical names.
116-
117115 def _create_multiple (self , entity_set : str , logical_name : str , records : List [Dict [str , Any ]]) -> List [str ]:
118116 if not all (isinstance (r , dict ) for r in records ):
119117 raise TypeError ("All items for multi-create must be dicts" )
@@ -160,14 +158,18 @@ def _create_multiple(self, entity_set: str, logical_name: str, records: List[Dic
160158
161159 # --- Derived helpers for high-level client ergonomics ---
162160 def _primary_id_attr (self , logical_name : str ) -> str :
163- """Return primary key attribute using metadata (fallback to <logical_name>id) ."""
161+ """Return primary key attribute using metadata; error if unavailable ."""
164162 pid = self ._logical_primaryid_cache .get (logical_name )
165163 if pid :
166164 return pid
167- # Resolve metadata (populates _logical_primaryid_cache)
165+ # Resolve metadata (populates _logical_primaryid_cache or raises if logical unknown )
168166 self ._entity_set_from_logical (logical_name )
169167 pid2 = self ._logical_primaryid_cache .get (logical_name )
170- return pid2 or f"{ logical_name } id"
168+ if pid2 :
169+ return pid2
170+ raise RuntimeError (
171+ f"PrimaryIdAttribute not resolved for logical name '{ logical_name } '. Metadata did not include PrimaryIdAttribute."
172+ )
171173
172174 def _update_by_ids (self , logical_name : str , ids : List [str ], changes : Union [Dict [str , Any ], List [Dict [str , Any ]]]) -> None :
173175 """Update many records by GUID list using UpdateMultiple under the hood.
@@ -502,10 +504,6 @@ def _entity_set_from_logical(self, logical: str) -> str:
502504 """
503505 if not logical :
504506 raise ValueError ("logical name required" )
505- # Heuristic: warn if caller passed a plural (common mistake after logical_name pivot)
506- if logical .endswith ("s" ) and not logical .endswith ("ss" ):
507- # Soft validation: if lookup fails we will raise a descriptive error below.
508- pass
509507 cached = self ._logical_to_entityset_cache .get (logical )
510508 if cached :
511509 return cached
@@ -566,7 +564,6 @@ def _get_entity_by_schema(self, schema_name: str) -> Optional[Dict[str, Any]]:
566564 items = r .json ().get ("value" , [])
567565 return items [0 ] if items else None
568566
569-
570567 def _create_entity (self , schema_name : str , display_name : str , attributes : List [Dict [str , Any ]]) -> str :
571568 url = f"{ self .api } /EntityDefinitions"
572569 payload = {
0 commit comments