-
Notifications
You must be signed in to change notification settings - Fork 699
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
Annotate channels with some ordered metadata #12944
base: develop
Are you sure you want to change the base?
Annotate channels with some ordered metadata #12944
Conversation
Build Artifacts
|
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.
If you can refer to the big comment at the top of models.py - we want to run this command:
kolibri manage generate_schema current
and commit the result as part of this PR too.
|
||
value_counts = {} | ||
for value in all_values: | ||
value_counts[value] = value_counts.get(value, 0) + 1 |
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.
This is a beautifully concise way to default the value to 0.
I thought I had fixed this last remaining flaky content test failure on postgres, but it still happened! Have rerun it. |
Looking good to me! I'll give it a bit more of a close review on Monday. If you can do the schema regeneration, I think this should be quickly mergeable. |
…tible with python 3.12, sqlacodegen is trying to import ArgSpec from the inspect module, but this has been removed in Python 3.12
done, but had to modify a bit |
inspect.ArgSpec = ArgSpec | ||
inspect.getargspec = getargspec | ||
|
||
# SQLAlchemy 2.0 compatibility patch |
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 do we need a compatibility patch with SQLAlchemy 2? We explicitly pin to less than 2, and I've not had any issues installing SQLAlchemy 1.4.49 in Python 3.12.
@@ -45,6 +46,9 @@ class ContentLocalfile(Base): | |||
class ContentContentnode(Base): | |||
__tablename__ = "content_contentnode" | |||
__table_args__ = ( | |||
CheckConstraint( |
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.
Adding the constraint checks seems to be causing the Python test errors.
Summary
ChannelMetadata
, it creates two new fields:included_categories
included_grade_levels
included_languages
from ManyToManyField to a special type (from a new added library dependency) calledSortedManyToManyField
ChannelMetadata
annotationscalculate_included_languages
calculate_ordered_categories
calculate_ordered_grade_levels
ordered_metadata_in_channels
, for previously annotated channels (Important note: this has to be skipped in KDP migrations)References
Fixes: #12880
Reviewer guidance