MCPcopy Create free account
hub / github.com/AQ-MedAI/MedMemoryBench / create

Method create

methods/letta/orm/sqlalchemy_base.py:375–389  ·  view source on GitHub ↗
(self, db_session: "Session", actor: Optional["User"] = None, no_commit: bool = False)

Source from the content-addressed store, hash-verified

373
374 @handle_db_timeout
375 def create(self, db_session: "Session", actor: Optional["User"] = None, no_commit: bool = False) -> "SqlalchemyBase":
376 logger.debug(f"Creating {self.__class__.__name__} with ID: {self.id} with actor={actor}")
377
378 if actor:
379 self._set_created_and_updated_by_fields(actor.id)
380 try:
381 db_session.add(self)
382 if no_commit:
383 db_session.flush() # no commit, just flush to get PK
384 else:
385 db_session.commit()
386 db_session.refresh(self)
387 return self
388 except (DBAPIError, IntegrityError) as e:
389 self._handle_dbapi_error(e)
390
391 @classmethod
392 @handle_db_timeout

Callers

nothing calls this directly

Calls 6

_handle_dbapi_errorMethod · 0.95
commitMethod · 0.80
debugMethod · 0.65
addMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected