bsovran opened a new issue, #41171:
URL: https://github.com/apache/superset/issues/41171

   ## [SIP] Proposal for adding an extensible `extra` metadata field to charts 
(`slices`)
   
   ### Motivation
   
   Superset datasets already support flexible metadata via the `extra` field, 
but charts (`slices`) do not have an equivalent extensible storage field.
   
   Teams building chart-level guidance and automation (for example, 
human-authored interpretation notes and machine-readable chart semantics) need 
a structured place to store metadata that does not fit into `description`, 
`certification_details`, or chart form data.
   
   Using `description` for this purpose is limiting because it is a user-facing 
text field rendered in UI contexts where structured JSON does not belong. 
Adding a flexible chart-level metadata field would provide a clear, first-class 
place for this type of information.
   
   ### Proposed Change
   
   Add a new nullable `extra` column to the `slices` table and corresponding 
`Slice` model field.
   
   - Column name: `extra`
   - Storage: JSON serialized as text (matching existing Superset patterns)
   - SQLAlchemy type: `MediumText` (`superset.utils.core.MediumText`)
   - Nullability: nullable, no server default
   
   `MediumText` is preferred over `Text` because chart metadata payloads can 
grow beyond small note-sized content, and existing large JSON-like chart fields 
(`params`, `query_context`) already use `MediumText`.
   
   Also include `extra` in chart import/export fields so metadata round-trips 
cleanly.
   
   ### New or Changed Public Interfaces
   
   This SIP proposes the DB/model foundation first:
   
   - New model attribute on `Slice`: `extra`
   - New DB column: `slices.extra`
   
   A follow-up change can expose this through chart REST schemas 
(`ChartPostSchema`, `ChartPutSchema`, GET response schema), but this proposal 
focuses on establishing the persisted storage contract.
   
   ### New dependencies
   
   None.
   
   ### Migration Plan and Compatibility
   
   - Add Alembic migration to create nullable `extra` column on `slices`.
   - Downgrade removes the column.
   - Fully backward compatible:
     - Existing charts unaffected (`NULL` default state).
     - Existing API behavior unchanged until schema exposure is added.
   
   ### Rejected Alternatives
   
   1. Reuse `description`
      - Rejected because it is a user-facing prose field and not appropriate 
for structured metadata.
   
   2. Add a separate chart annotation table
      - Rejected for now due to added complexity and join overhead for a use 
case that can be modeled as chart-scoped extensible metadata.
   
   3. Store metadata only in frontend/local state
      - Rejected because metadata should be durable, versionable, and shared 
across users and automation workflows.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to