-
Notifications
You must be signed in to change notification settings - Fork 16.4k
fix(database): handle undefined schema during CSV upload #36792
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
base: master
Are you sure you want to change the base?
fix(database): handle undefined schema during CSV upload #36792
Conversation
Code Review Agent Run #c6f16fActionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Nitpicks 🔍
|
| return | ||
|
|
||
| # Treat empty or frontend-sent "undefined" schema as no schema | ||
| if not self._schema or self._schema == "undefined": |
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.
Suggestion: Edge case: the current check if not self._schema or self._schema == "undefined": does not treat whitespace-only schema values or case variations (e.g., " ", "Undefined") as empty/undefined and may pass an invalid schema through; trim and do a case-insensitive check before deciding to treat it as absent. [possible bug]
Severity Level: Critical 🚨
| if not self._schema or self._schema == "undefined": | |
| if self._schema is None or ( | |
| isinstance(self._schema, str) | |
| and (self._schema.strip() == "" or self._schema.strip().lower() == "undefined") | |
| ): |
Why it matters? ⭐
This is a practical hardening: the current check misses whitespace-only strings and case variants like "Undefined". Using .strip() and a case-insensitive comparison avoids passing invalid values through as real schema names. It fixes a real edge case that can cause confusing validation or DB lookups.
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** superset/commands/database/uploaders/base.py
**Line:** 163:163
**Comment:**
*Possible Bug: Edge case: the current check `if not self._schema or self._schema == "undefined":` does not treat whitespace-only schema values or case variations (e.g., `" "`, `"Undefined"`) as empty/undefined and may pass an invalid schema through; trim and do a case-insensitive check before deciding to treat it as absent.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.|
CodeAnt AI finished reviewing your PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #36792 +/- ##
===========================================
+ Coverage 0 68.10% +68.10%
===========================================
Files 0 640 +640
Lines 0 47633 +47633
Branches 0 5202 +5202
===========================================
+ Hits 0 32442 +32442
- Misses 0 13911 +13911
- Partials 0 1280 +1280
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
User description
Summary
Fixes an error during CSV upload when the frontend sends an empty or "undefined" schema value.
What changed
###Demo
#Before:

#After:
localhost_8088_superset_welcome_.-.Google.Chrome.2025-12-22.16-57-38.mp4
Reproduction
CodeAnt-AI Description
Handle empty or "undefined" schema values during CSV upload so database defaults are used
What Changed
Impact
✅ Fewer CSV upload failures when schema is blank✅ Successful uploads when frontend sends "undefined" for schema✅ Clearer logs for schema-related upload fallbacks💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.