feat: DB migration for dataset folders#32680
Conversation
There was a problem hiding this comment.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
| Category | Issue | Fix Detected |
|---|---|---|
| Misleading migration name ▹ view | ||
| Denormalized Database Design Using JSON Column ▹ view | ||
| Migration description missing column details ▹ view | ||
| Missing JSON default value ▹ view |
Files scanned
| File Path | Reviewed |
|---|---|
| superset/migrations/versions/2025-03-03_20-52_94e7a3499973_add_folder_table.py | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Need a new review? Comment
/korbit-reviewon this PR and I'll review your latest changes.Korbit Guide: Usage and Customization
Interacting with Korbit
- You can manually ask Korbit to review your PR using the
/korbit-reviewcommand in a comment at the root of your PR.- You can ask Korbit to generate a new PR description using the
/korbit-generate-pr-descriptioncommand in any comment on your PR.- Too many Korbit comments? I can resolve all my comment threads if you use the
/korbit-resolvecommand in any comment on your PR.- On any given comment that Korbit raises on your pull request, you can have a discussion with Korbit by replying to the comment.
- Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.
Customizing Korbit
- Check out our docs on how you can make Korbit work best for you and your team.
- Customize Korbit for your organization through the Korbit Console.
Current Korbit Configuration
General Settings
Setting Value Review Schedule Automatic excluding drafts Max Issue Count 10 Automatic PR Descriptions ❌ Issue Categories
Category Enabled Documentation ✅ Logging ✅ Error Handling ✅ Readability ✅ Design ✅ Performance ✅ Security ✅ Functionality ✅ Feedback and Support
Note
Korbit Pro is free for open source projects 🎉
Looking to add Korbit to your team? Get started with a free 2 week trial here
There was a problem hiding this comment.
Misleading migration name 
Tell me more
What is the issue?
The migration name is misleading as it adds a column to an existing table rather than creating a new table.
Why this matters
This could cause confusion during code maintenance and make it harder to track schema changes accurately.
Suggested change ∙ Feature Preview
Change the migration name to accurately reflect the change:
"""Add folders column to tables table"""💬 Looking for more details? Reply to this comment to chat with Korbit.
superset/migrations/versions/2025-03-03_20-52_94e7a3499973_add_folder_table.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Migration description missing column details 
Tell me more
What is the issue?
The migration docstring lacks information about the purpose and structure of the new 'folders' column being added.
Why this matters
Future developers will not understand the intended use of the JSON column or its schema, making it harder to maintain or debug issues.
Suggested change ∙ Feature Preview
"""Add folder table
Revision ID: 94e7a3499973
Revises: 74ad1125881c
Create Date: 2025-03-03 20:52:24.585143
Adds a JSON column 'folders' to the tables table to store folder hierarchy and metadata
for organizing tables. The column is nullable to maintain backward compatibility.
"""
💬 Looking for more details? Reply to this comment to chat with Korbit.
superset/migrations/versions/2025-03-03_20-52_94e7a3499973_add_folder_table.py
Outdated
Show resolved
Hide resolved
898ccc4 to
3053921
Compare
| def upgrade(): | ||
| op.add_column( | ||
| "tables", | ||
| sa.Column("folders", JSON, nullable=True), |
There was a problem hiding this comment.
@sadpandajoe mentioned that there's a utility for this?
There was a problem hiding this comment.
I couldn't find one in superset/migrations/utils. 😕
There was a problem hiding this comment.
it's kinda buried towards the bottom: https://github.com/apache/superset/blob/master/superset/migrations/shared/utils.py#L294
(cherry picked from commit b64e325)
(cherry picked from commit b64e325)
(cherry picked from commit b64e325)
(cherry picked from commit b64e325)
(cherry picked from commit b64e325)
SUMMARY
DB migration for #32520, separated to make it easy to cherry-pick.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION