-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Feat update schemas #803
Feat update schemas #803
Changes from all commits
122d735
58212eb
ef0f63d
6deb2eb
c4dd341
1074137
c430ea9
b07e814
508cd9f
a5f6dd6
0f5014d
0a2e52c
b44be94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,10 +50,18 @@ async def get_task_count_in_project(db: Session, project_id: int): | |
|
||
def get_task_lists(db: Session, project_id: int): | ||
"""Get a list of tasks for a project.""" | ||
query = f"""select id from tasks where project_id = {project_id}""" | ||
result = db.execute(query) | ||
tasks = [task[0] for task in result.fetchall()] | ||
return tasks | ||
query = text(""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need the SQL wrapped in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have used sqlalchemy db session. it was not required in the previous stage. But, it is required since your latest update. It might be because of pydantic?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No it's not related to pydantic, but there is no harm having the |
||
SELECT id | ||
FROM tasks | ||
WHERE project_id = :project_id | ||
""") | ||
|
||
# Then execute the query with the desired parameter | ||
result = db.execute(query, {"project_id": project_id}) | ||
|
||
# Fetch the result | ||
task_ids = [row.id for row in result] | ||
return task_ids | ||
|
||
|
||
def get_tasks( | ||
|
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.
Try to avoid using SQLAlchemy, as we will remove it in the future.
The raw SQL equivalent is probably best 👍