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

New column entry to separate source from project url #2568

Merged
merged 8 commits into from
Mar 18, 2022

Conversation

mayaCostantini
Copy link
Contributor

@mayaCostantini mayaCostantini commented Jan 31, 2022

Related Issues and Dependencies

Related to #2566

This introduces a breaking change

  • No

This should yield a new module release

  • Yes

This Pull Request implements

Create a label column separated from the url column in the python_package_metadata_project_url table to parse project URLs easily.

@sesheta sesheta added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jan 31, 2022
@mayaCostantini
Copy link
Contributor Author

/assign @fridex

Copy link
Contributor

@fridex fridex left a 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 💯 👍🏻

@@ -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)
Copy link
Contributor

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.

Copy link
Contributor Author

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

@sesheta sesheta added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 31, 2022
@mayaCostantini mayaCostantini force-pushed the correct-url-entries branch 3 times, most recently from bbf6eda to d3796f5 Compare February 2, 2022 12:41
@mayaCostantini
Copy link
Contributor Author

/hold
Needs taking care of old records in the migration

@sesheta sesheta added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 2, 2022
@mayaCostantini
Copy link
Contributor Author

/unhold

@sesheta sesheta removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 3, 2022
@pacospace
Copy link
Contributor

/hold

@sesheta sesheta added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 4, 2022
@pacospace
Copy link
Contributor

pacospace commented Feb 4, 2022

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 :)

@mayaCostantini
Copy link
Contributor Author

Thanks @pacospace , yes let's do it :)

@pacospace
Copy link
Contributor

I opened mayaCostantini#1 to be merged in your branch and tested migration 🚀

@mayaCostantini
Copy link
Contributor Author

@pacospace thanks for the changes 💯 , ready for review 👍

Copy link
Contributor

@pacospace pacospace left a 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 ###
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, will do 👍

Copy link
Contributor

@pacospace pacospace left a comment

Choose a reason for hiding this comment

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

Thanks! 💯

@sesheta
Copy link
Member

sesheta commented Feb 4, 2022

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sesheta sesheta added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 4, 2022
@fridex
Copy link
Contributor

fridex commented Feb 4, 2022

/hold

I think there could be one issue. Let me check it.

@pacospace
Copy link
Contributor

/unhold

@sesheta sesheta removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 4, 2022
@pacospace
Copy link
Contributor

/hold

@sesheta sesheta added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 4, 2022
@pacospace
Copy link
Contributor

sorry I didn't see the comment

Copy link
Contributor

@fridex fridex left a 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")
Copy link
Contributor

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.

@goern
Copy link
Member

goern commented Feb 17, 2022

ping

@mayaCostantini
Copy link
Contributor Author

@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

@mayaCostantini
Copy link
Contributor Author

/unhold
I could finally test my changes to the data migration and they seem to have worked. I just removed some entries where only the url was present but the label was missing, let me know if I should replace this value instead.

@sesheta sesheta removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 18, 2022
@sesheta sesheta merged commit f5dc180 into thoth-station:master Mar 18, 2022
@mayaCostantini mayaCostantini deleted the correct-url-entries branch June 16, 2022 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants