-
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
First commit #947
base: master
Are you sure you want to change the base?
First commit #947
Conversation
app/main.py
Outdated
# print(Actor.objects.all()) | ||
# Actor.objects.delete(1) | ||
# print(Actor.objects.all()) | ||
from models import Actor |
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.
no need to push changes to this file
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.
please revert all changes to this file
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.
this file should look the same as on master 😿
app/managers.py
Outdated
class ActorManager: | ||
def __init__(self) -> None: | ||
self._connection = sqlite3.connect( | ||
"C:\\Users\\vlada\\py-actor-manager\\identifier.sqlite" |
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.
don't hardcode path to db
app/managers.py
Outdated
|
||
def create(self, first_name: str, last_name: str) -> None: | ||
self._connection.execute( | ||
f"INSERT " |
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 is common to use triple quotes for multilne queries
Also check sql format so it follows the standards. This resource will help https://sqlformat.org/
app/managers.py
Outdated
|
||
|
||
if __name__ == "__main__": | ||
manager = ActorManager() |
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.
you don't need this here - code is being executed in main
table.png
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.
there is no requirement to upload screenshot in this task
app/managers.py
Outdated
f"""UPDATE {self.table_name} """ | ||
f"""SET first_name = ?, last_name = ? """ | ||
f"""WHERE id = ?""", |
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.
No need to put triple quotes in each line, the main idea put it in the beginning and in the end, chek everywhere
app/main.py
Outdated
# print(Actor.objects.all()) | ||
# Actor.objects.delete(1) | ||
# print(Actor.objects.all()) | ||
from models import Actor |
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.
please revert all changes to this file
@@ -0,0 +1,57 @@ | |||
import sqlite3 | |||
import os | |||
from models import Actor |
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.
should be blank line between imports
app/managers.py
Outdated
class ActorManager: | ||
def __init__(self) -> None: | ||
self._connection = sqlite3.connect( | ||
os.path.join(os.path.dirname(__file__), "identifier.sqlite") |
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.
database name should be cinema
as per task requirements
app/managers.py
Outdated
def all(self) -> None: | ||
actor_manager_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.
should be
SELECT *
FROM {self.table_name}
SQL keywords must start from new lines
app/main.py
Outdated
# print(Actor.objects.all()) | ||
# Actor.objects.delete(1) | ||
# print(Actor.objects.all()) | ||
from models import Actor |
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.
this file should look the same as on master 😿
app/managers.py
Outdated
@@ -0,0 +1,60 @@ | |||
import sqlite3 | |||
|
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.
should be blank line between different types of imports - os and sqlite3 are build-in so they are the same type. only from app.models import Actor should be separated
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.
Approved..
No description provided.