-
Notifications
You must be signed in to change notification settings - Fork 16
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
New column entry to separate source from project url #2568
New column entry to separate source from project url #2568
Conversation
/assign @fridex |
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.
One comment. I wonder if we should handle old records in the migration. Otherwise 💯 👍🏻
thoth/storages/graph/models.py
Outdated
@@ -1499,7 +1499,8 @@ class PythonPackageMetadataProjectUrl(Base, BaseExtension): | |||
__tablename__ = "python_package_metadata_project_url" | |||
|
|||
id = Column(Integer, primary_key=True, autoincrement=True) | |||
project_url = Column(Text, nullable=True) | |||
url = Column(Text, nullable=True) | |||
source = Column(Text, nullable=True) |
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 might be a good idea to name this as a label to follow the specification.
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.
Thanks 💯 Changes were added in 7260f0b
bbf6eda
to
d3796f5
Compare
thoth/storages/data/alembic/versions/2b787ddad4a4_separate_the_project_url_column_from_.py
Outdated
Show resolved
Hide resolved
/hold |
841dfae
to
b82b8c9
Compare
/unhold |
/hold |
The approach is correct @mayaCostantini and very nice! There are some small things to adjust, I can send a PR to your branch for this to be included here :) |
Thanks @pacospace , yes let's do it :) |
I opened mayaCostantini#1 to be merged in your branch and tested migration 🚀 |
@pacospace thanks for the changes 💯 , ready for review 👍 |
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.
One final instruction missing and we should be good to go :)
) | ||
op.bulk_insert(python_package_metadata_project_url_table, projects_source_url) | ||
op.bulk_insert(has_metadata_project_url_table, metadata_project_url_links) | ||
# ### end Alembic commands ### |
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 realized we need to add a last command: op.drop_column("has_metadata_project_url", "id")
to be consistent with the rest of the database.
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.
Ok, will do 👍
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.
Thanks! 💯
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pacospace The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold I think there could be one issue. Let me check it. |
/unhold |
/hold |
sorry I didn't see the comment |
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.
Finally had this on my list. PTAL on the comment.
{"python_package_metadata_id": r[0], "python_package_metadata_project_url_id": r[1]} for r in result_has | ||
] | ||
op.drop_table("has_metadata_project_url") | ||
op.drop_table("python_package_metadata_project_url") |
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'm unsure here if dropping tables is correct. I think we will lose all the linkage between other tables. Could the query be rewritten so that tables are not dropped and python_package_metadata_project_url
table is updated using:
UPDATE python_package_metadata_project_url SET label={label}, url={url} WHERE id={id}
I think that will simplify the migration and reduce any possible errors in the database.
ping |
@goern This needs testing using postgres which I can't do at the moment, I will come back to it as soon as my problem is solved |
Signed-off-by: Francesco Murdaca <[email protected]>
174376c
to
b0a3823
Compare
/unhold |
Related Issues and Dependencies
Related to #2566
This introduces a breaking change
This should yield a new module release
This Pull Request implements
Create a
label
column separated from theurl
column in thepython_package_metadata_project_url
table to parse project URLs easily.