Skip to content

Commit

Permalink
commit to update added
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Katkalov committed Sep 6, 2023
1 parent 5cbe69b commit c826c07
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 9 additions & 9 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
if __name__ == "__main__":
Actor.objects = ActorManager()

Actor.objects.create(first_name="Emma", last_name="Watson")
Actor.objects.create(first_name="Daniel", last_name="Radclife")
print(Actor.objects.all())
Actor.objects.update(24, "Daniel", "Radcliffe")
print(Actor.objects.all())
Actor.objects.delete(24)
print(Actor.objects.all())
Actor.objects.make_table_clear()
print(Actor.objects.all())
# Actor.objects.create(first_name="Emma", last_name="Watson")
# Actor.objects.create(first_name="Daniel", last_name="Radclife")
# print(Actor.objects.all())
Actor.objects.update("Daniel", "Radcliffe", 1)
# print(Actor.objects.all())
# Actor.objects.delete(24)
# print(Actor.objects.all())
# Actor.objects.make_table_clear()
# print(Actor.objects.all())
2 changes: 2 additions & 0 deletions app/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def update(
(first_name_, last_name_, id_to_update),
)

self._connection.commit()

def delete(self, id_to_delete: int) -> None:
self._connection.execute(
f"DELETE FROM {self.table_name} " f"WHERE id = ?", (id_to_delete,)
Expand Down

0 comments on commit c826c07

Please sign in to comment.