-
Notifications
You must be signed in to change notification settings - Fork 943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solution #462
base: master
Are you sure you want to change the base?
Solution #462
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
app/cinema_db.db3
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
read the checklist
app/managers.py
Outdated
|
||
def all(self) -> List[Actor]: | ||
actors_cursor = self._connection.execute( | ||
f"SELECT * FROM {self.table_name}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better to move FROM to the new line, increase readability
app/managers.py
Outdated
|
||
def delete(self, id_to_delete: int) -> None: | ||
self._connection.execute( | ||
f"DELETE FROM {self.table_name} " f"WHERE id = ?", (id_to_delete,) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same about WHERE
app/managers.py
Outdated
if __name__ == "__main__": | ||
manager = ActorManager() | ||
print(manager.all()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant
app/managers.py
Outdated
self._connection.execute( | ||
f"UPDATE {self.table_name} " | ||
f"SET first_name = ?, last_name = ?" | ||
f"WHERE id = ?", | ||
(new_first_name, new_last_name, id_to_update), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you have syntax error here in SQL query
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Serhii-Leonenko I don't see what's wrong here, can you explain ? :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, maybe whitespace after last_name? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -40,7 +40,7 @@ def update( | |||
) -> None: | |||
self._connection.execute( | |||
f"UPDATE {self.table_name} " | |||
f"SET first_name = ?, last_name = ?" | |||
f"SET first_name = ?, last_name = ? " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, i told about this space
No description provided.