Skip to content

Convert flexible field values to SQL before storing them #5833

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Maxr1998
Copy link
Contributor

Description

This is required to support multivalued fields as flexible fields.
See #5698 for more details.

To Do

  • Changelog. (Add an entry to docs/changelog.rst to the bottom of one of the lists near the top of the document.)
  • Tests. (Very much encouraged but not strictly required.)

(will add those later)

This is required to support multivalued fields as flexible fields.
@Copilot Copilot AI review requested due to automatic review settings June 22, 2025 14:57
Copy link

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds conversion of flexible field values to their SQL representation before inserting them into the database, enabling support for multivalued flexible fields.

  • Applies to_sql on each flexible field value prior to storage.
  • Removes keys from the dirty set as before, then converts and inserts the SQL value.
  • (To be added) Changelog and tests for the new behavior.
Comments suppressed due to low confidence (2)

beets/dbcore/db.py:607

  • [nitpick] Overwriting the original value variable may reduce readability; consider assigning the converted value to a new variable (e.g., sql_value) and using that in the mutate call.
                    value = self._type(key).to_sql(value)

beets/dbcore/db.py:607

  • Add tests to cover the new to_sql conversion path for flexible fields, verifying that multivalued and edge-case values produce the expected SQL representations.
                    value = self._type(key).to_sql(value)

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.

1 participant