comparison sat/memory/sqla.py @ 3813:1a10b8b4f169

core (memory/sqla): `session_add` must have a default value in `delete`
author Goffi <goffi@goffi.org>
date Wed, 29 Jun 2022 10:16:03 +0200
parents b5013bada4b6
children 100dd30244c6
comparison
equal deleted inserted replaced
3812:722a38e78fd1 3813:1a10b8b4f169
221 self, 221 self,
222 client: SatXMPPEntity, 222 client: SatXMPPEntity,
223 db_cls: DeclarativeMeta, 223 db_cls: DeclarativeMeta,
224 db_id_col: Mapped, 224 db_id_col: Mapped,
225 id_value: Any, 225 id_value: Any,
226 joined_loads=None 226 joined_loads = None
227 ) -> Optional[DeclarativeMeta]: 227 ) -> Optional[DeclarativeMeta]:
228 stmt = select(db_cls).where(db_id_col==id_value) 228 stmt = select(db_cls).where(db_id_col==id_value)
229 if client is not None: 229 if client is not None:
230 stmt = stmt.filter_by(profile_id=self.profiles[client.profile]) 230 stmt = stmt.filter_by(profile_id=self.profiles[client.profile])
231 if joined_loads is not None: 231 if joined_loads is not None:
246 246
247 @aio 247 @aio
248 async def delete( 248 async def delete(
249 self, 249 self,
250 db_obj: Union[DeclarativeMeta, List[DeclarativeMeta]], 250 db_obj: Union[DeclarativeMeta, List[DeclarativeMeta]],
251 session_add: Optional[List[DeclarativeMeta]] 251 session_add: Optional[List[DeclarativeMeta]] = None
252 ) -> None: 252 ) -> None:
253 """Delete an object from database 253 """Delete an object from database
254 254
255 @param db_obj: object to delete or list of objects to delete 255 @param db_obj: object to delete or list of objects to delete
256 @param session_add: other objects to add to session. 256 @param session_add: other objects to add to session.