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

Fix(samples endpoint) Moved join(Analysis) out of smaller functions #69

Merged
merged 2 commits into from
Oct 4, 2022

Conversation

Vince-janv
Copy link
Contributor

Description

Currently when using both the plate_id and incomplete parameters, the following error is raised:

sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (1066, "Not unique table/alias: 'analysis'")
[SQL: SELECT sample.status, sample.comment, sample.sex, sample.created_at, sample.id
FROM sample INNER JOIN analysis ON sample.id = analysis.sample_id INNER JOIN analysis ON sample.id = analysis.sample_id
WHERE analysis.plate_id = %(plate_id_1)s GROUP BY analysis.sample_id
HAVING count(analysis.sample_id) < %(count_1)s ORDER BY analysis.created_at, sample.created_at DESC
LIMIT %(param_1)s, %(param_2)s]
[parameters: {'plate_id_1': '120', 'count_1': 2, 'param_1': 0, 'param_2': 10}]

Changed

  • Moved the join(Analysis) statement out of the smaller functions

Steps to consider while deploying

  • Configuration changes:
  • Documentation updates:
  • Inform users by email:

Review:

  • Code approved by
  • Tests executed on stage by: (Document the test done with screen shots and description.)
  • "Merge and deploy" approved by

This version is a:

  • MAJOR - when you make incompatible API changes
  • MINOR - when you add functionality in a backwards compatible manner
  • PATCH - when you make backwards compatible bug fixes or documentation/instructions

@Vince-janv
Copy link
Contributor Author

All parameters can now be used in conjuncture:

Screenshot 2022-10-03 at 15 18 08

@Vince-janv Vince-janv marked this pull request as ready for review October 3, 2022 13:56
Copy link

@thelander thelander left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@Vince-janv Vince-janv merged commit 4feaa27 into main Oct 4, 2022
@Vince-janv Vince-janv deleted the fix-read-samples-query branch October 4, 2022 07:30
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.

GET samples endpoint with both plate_id and incomplete=true parameters is returning 500
2 participants