async def delete(self, obj, recursive=False, delete_nullable=False):
if recursive:<EOL><INDENT>dependencies = obj.dependencies(delete_nullable)<EOL>for cond, fk in reversed(list(dependencies)):<EOL><INDENT>model = fk.model<EOL>if fk.null and not delete_nullable:<EOL><INDENT>sq = model.update(**{fk.name: None}).where(cond)<EOL><DEDENT>else:<EOL><INDENT>sq = model.delete().where(cond)<EOL><DEDENT>await self.execute(sq)<EOL><DEDENT><DEDENT>query = obj.delete().where(obj._pk_expr())<EOL>return (await self.execute(query))<EOL>
Delete object from database.