-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
feat: add migration for adding default db and schema to model #19425
Conversation
9066bcd
to
6dd7947
Compare
6dd7947
to
03bbb0d
Compare
❗ Please consider rebasing your branch to avoid db migration conflicts. |
Codecov Report
@@ Coverage Diff @@
## master #19425 +/- ##
=======================================
Coverage 66.55% 66.55%
=======================================
Files 1670 1670
Lines 63824 63824
Branches 6510 6510
=======================================
Hits 42481 42481
Misses 19654 19654
Partials 1689 1689
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
❗ Please consider rebasing your branch to avoid db migration conflicts. |
b2a5c3c
to
f664548
Compare
f664548
to
4dfbd20
Compare
e1fcb45
to
02eb0b6
Compare
database_id = sa.Column(sa.Integer, sa.ForeignKey("dbs.id"), nullable=False) | ||
default_database: Database = relationship( | ||
"Database", | ||
foreign_keys=[database_id], |
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.
wouldn't we pull this information from the tables? cc @betodealmeida
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.
initially we would on create, but the main issue is being able to filter/query via the ModelRestApi
the class currently doesn't allow us to join across models, which is making it difficult to for me to get the filtering to work properly for these columns. So the idea was to add default column for both schema and database to allow us to be able to power the CRUD filtering and we'd allow the user to update this field through settings.
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.
@eschutho I talked with Hugh about this, we think we need the concept of a 'default database'. Right now there's an implicit assumption that all tables belong to the same database, but having a default database would allow us to relax that restriction in the future.
It's similar with schema, tables can belong to different schemas today, but there's still a concept of a default schema which is needed if the query references only the table name.
02eb0b6
to
4f23a9c
Compare
4f23a9c
to
482479d
Compare
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.
I found a small bug, but I'm also concerned about performance. I think AirBnB would have a hard time running this migration in their system, and we need to spend some time optimizing it.
superset/migrations/versions/d77e075540d1_add_default_db_schema_dataset_model.py
Outdated
Show resolved
Hide resolved
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.
Please hold on making more changes to this PR until #19421 is approved.
…a_dataset_model.py Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>
SUMMARY
Adding 2 new columns to sip-68 new dataset model to allow users to easily query based upon the
default_schema
+default_database
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
Benchmarking: