Skip to content
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

db: Add query review tables and update QueryExecutionStatus enum #19

Merged
merged 8 commits into from
Dec 18, 2024

Conversation

zhangvi7
Copy link
Owner

@zhangvi7 zhangvi7 commented Dec 10, 2024

Changes

  • QueryReview table for reviews
  • QueryExecutionReviewer association table
  • New QueryExecution enums "PENDING_REVIEW", "REJECTED", for executions in review process
  • Alembic migration file

Comment on lines 34 to 36
status = sql.Column(
sql.Enum(QueryReviewStatus), nullable=False, default=QueryReviewStatus.PENDING
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for a query review, it will link to a query execution by query_execution_id, which also contains the review status, it seems duplicate with this review status to me. maybe

  1. we dont really need this QueryReviewStatus, just use the execution status instead
  2. or for the QueryExecutionStatus, we only introduce a general PENDING status, but not specific to review pending, and no rejected status. so every execution will start with a PENDING status.

Comment on lines 37 to 30
review_request_reason = sql.Column(
sql.String(length=description_length), nullable=True
)
rejection_reason = sql.Column(sql.String(length=description_length), nullable=True)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think request and rejection reason should be both required

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized we will only have rejection reason after reviewer rejects, so will make rejection_reason nullable=True for review request creation

)

if updated:
query_review.updated_at = datetime.datetime.now()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the update() function above already handles the update_at field.

@zhangvi7
Copy link
Owner Author

zhangvi7 commented Dec 16, 2024

Changes:

  • Removed queryreviewstatus enum, use existing QueryExecutionStatus instead
  • Removed query_author_id from QueryReview table since info already exists within related query execution
  • Regenerated alembic file


@with_session
def get_query_review_from_query_execution_id(query_execution_id: int, session=None):
query_execution = get_query_execution_by_id(query_execution_id, session=session)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why go through the route of getting query execution, we could do

QueryReview.get(query_execution_id=query_execution_id, session=session)

@zhangvi7 zhangvi7 force-pushed the peer-review/frontend branch from d122269 to 76f8903 Compare December 17, 2024 00:52
@zhangvi7 zhangvi7 merged commit 78c32ca into peer-review/frontend Dec 18, 2024
@zhangvi7 zhangvi7 deleted the peer-review/db branch December 18, 2024 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants