MCPcopy Index your code
hub / github.com/piccolo-orm/piccolo / remove

Method remove

piccolo/table.py:583–598  ·  view source on GitHub ↗

A proxy to a delete query.

(self)

Source from the content-addressed store, hash-verified

581 return UpdateSelf(row=self, values=values)
582
583 def remove(self) -> Delete:
584 """
585 A proxy to a delete query.
586 """
587 primary_key_value = getattr(self, self._meta.primary_key._meta.name)
588
589 if not primary_key_value:
590 raise ValueError("Can only delete pre-existing rows with a PK.")
591
592 setattr(self, self._meta.primary_key._meta.name, None)
593
594 self._exists_in_db = False
595
596 return self.__class__.delete().where(
597 self.__class__._meta.primary_key == primary_key_value
598 )
599
600 def refresh(
601 self,

Callers 4

test_removeMethod · 0.45
test_removeMethod · 0.45
test_remove_sqliteMethod · 0.45

Calls 2

deleteMethod · 0.80
whereMethod · 0.45

Tested by 4

test_removeMethod · 0.36
test_removeMethod · 0.36
test_remove_sqliteMethod · 0.36