Skip to content

feat: DB migration for dataset folders #32680

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

Merged
merged 1 commit into from
Mar 14, 2025
Merged

Conversation

betodealmeida
Copy link
Member

@betodealmeida betodealmeida commented Mar 14, 2025

SUMMARY

DB migration for #32520, separated to make it easy to cherry-pick.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@github-actions github-actions bot added the risk:db-migration PRs that require a DB migration label Mar 14, 2025
@dosubot dosubot bot added the data:dataset Related to dataset configurations label Mar 14, 2025
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Fix Detected
Readability Misleading migration name ▹ view
Design Denormalized Database Design Using JSON Column ▹ view
Documentation Migration description missing column details ▹ view
Functionality 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-review on 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-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command 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

# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""Add folder table
Copy link

Choose a reason for hiding this comment

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

Misleading migration name category Readability

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"""

Report a problem with this comment

💬 Looking for more details? Reply to this comment to chat with Korbit.

Comment on lines 17 to 23
"""Add folder table

Revision ID: 94e7a3499973
Revises: 74ad1125881c
Create Date: 2025-03-03 20:52:24.585143

"""
Copy link

Choose a reason for hiding this comment

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

Migration description missing column details category Documentation

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.
"""

Report a problem with this comment

💬 Looking for more details? Reply to this comment to chat with Korbit.

def upgrade():
op.add_column(
"tables",
sa.Column("folders", JSON, nullable=True),
Copy link
Member

Choose a reason for hiding this comment

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

@sadpandajoe mentioned that there's a utility for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I couldn't find one in superset/migrations/utils. 😕

Copy link
Member

Choose a reason for hiding this comment

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

@betodealmeida betodealmeida merged commit b64e325 into master Mar 14, 2025
41 checks passed
@betodealmeida betodealmeida deleted the folder-api-migration branch March 14, 2025 21:16
@michael-s-molina michael-s-molina added the v5.0 Label added by the release manager to track PRs to be included in the 5.0 branch label Mar 25, 2025
michael-s-molina pushed a commit that referenced this pull request Mar 25, 2025
@michael-s-molina michael-s-molina removed the v5.0 Label added by the release manager to track PRs to be included in the 5.0 branch label Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:dataset Related to dataset configurations preset-io risk:db-migration PRs that require a DB migration size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants