MCPcopy
hub / github.com/Agenta-AI/agenta / update_organization

Function update_organization

api/oss/src/services/db_manager.py:1156–1178  ·  view source on GitHub ↗

Update the specified organization in the database. Args: organization_id (str): The ID of the organization values_to_update (Dict[str, Any]): The values to update in the organization

(organization_id: str, values_to_update: Dict[str, Any])

Source from the content-addressed store, hash-verified

1154
1155
1156async def update_organization(organization_id: str, values_to_update: Dict[str, Any]):
1157 """
1158 Update the specified organization in the database.
1159
1160 Args:
1161 organization_id (str): The ID of the organization
1162 values_to_update (Dict[str, Any]): The values to update in the organization
1163 """
1164
1165 async with engine.core_session() as session:
1166 result = await session.execute(
1167 select(OrganizationDB).filter_by(id=uuid.UUID(organization_id))
1168 )
1169 organization = result.scalar()
1170 if organization is None:
1171 raise Exception(f"Organization with ID {organization_id} not found")
1172
1173 for key, value in values_to_update.items():
1174 if hasattr(organization, key):
1175 setattr(organization, key, value)
1176
1177 await session.commit()
1178 await session.refresh(organization)
1179
1180
1181async def create_or_update_default_project(values_to_update: Dict[str, Any]):

Callers 1

create_accountsFunction · 0.85

Calls 2

core_sessionMethod · 0.80
commitMethod · 0.45

Tested by

no test coverage detected