-
Notifications
You must be signed in to change notification settings - Fork 80
Relax db #1073
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
Relax db #1073
Conversation
@biocore/qiita-dev This is ready for review. Note that this is going to it's own branch. Tests are expected to fail. The only thing that I'm changing in this PR is the database layout and the populate test database file, so it can be successfully added after the new changes have been made. |
@biocore/qiita-dev The |
sql = """SELECT DISTINCT study_id from qiita.required_sample_info""" | ||
study_ids = set(s[0] for s in conn_handler.execute_fetchall(sql)) | ||
|
||
queue_name = "PATCH_21" |
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.
queue name should be 23, right? Not blocking.
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.
Good catch. Changed to avoid future confusions.
Looks fine but it seems like all these changes can be done directly in a sql and not in python ... |
I can investigate on how to do everything on SQL. I'll dedicate a short period of time, otherwise I'm not going to meet the deadline. If you have a suggestion it will likely help me a lot to reduce development burden. |
I do not think is blocking, just curious why this choice?
|
Shorter development time, I'm still getting used to more complex SQL queries, although I'm pretty exited on taking advantage of SQL. |
OK 👍 as we do not have any rules about this what should go in a sql or py patch. |
Great thanks |
# Since that table no longer stores required metadata, | ||
# we are going to rename it | ||
sql = """ALTER TABLE qiita.required_sample_info | ||
RENAME TO study_sample""" |
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.
Is the schema implicit?
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 will move this to SQL but just FYI, since you are changing the name of the table you don't need the schema. Actually, if you put the schema does not work (I've tested it on my system cause I also thought it was needed)
# Since that table no longer stores common prep template metadata, | ||
# we are going to rename it | ||
sql = """ALTER TABLE qiita.common_prep_info | ||
RENAME TO prep_template_sample""" |
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.
as @wasade said above, this probably needs schema in front of the name.
Few comments on the python patch. All in all, the logic on this is extremely hard to follow and I think it would be greatly improved if moved over to straight SQL. This would also take care of @wasade's concern about the selects being outside the queue. |
@squirrelo, agree. I think it would be dangerous to have this patch run on a database that is not absolutely quiet (as no other connections except the one executing this patch). |
Thanks guys, I will try to do everything in SQL, those concerns are legitimate. |
@wasade @antgonza @squirrelo I moved everything to the SQL. Ready for review. |
latitude=sv.latitude, | ||
longitude=sv.longitude, | ||
required_sample_info_status=sv.status | ||
FROM sample_values sv |
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.
Why rename it here to sv when you can use WITH sv AS
on line 52.
Python patch is broken:
|
Yes, python patch is broken because it relies on code that it needs to be added later. Just as a remainder, this is broken up a 44 file PR that we agreed was too hard to review. The system will not be fully functional until all PR go in the branch... |
How are you testing the patch then? This needs to be complete for the patch to work at least, if it's going to be the actual patch PR. |
I've tested only the SQL patch, as the python patch is independent of the data in the database. I've commented out the python patch for the time being, so I can add it back once the functionality that I need is in place. @squirrelo if you don't agree with that, I'll happy to do another 44 files PR and I hope you'll have fun reviewing it. |
Since this is on a separate branch, can you please pull the python patch out of this PR and add it back in when it works, so we don't forget to test it later on. |
Done |
👍 |
Note: this PR is made against the new
relax-md-req
.I'm only changing the SQL layout and the populate_test_db.sql, so people can check if there is something terribly wrong.
I'm not changing any code, so tests are expected to fail.
In the next PR, (which will be build on top of this one) I'll start fixing the metadata_template objects, so some tests start passing with the new layout :-)