-
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
fix(load_examples): better fix for load_data #12702
Conversation
@@ -125,6 +125,8 @@ def import_dataset( | |||
def load_data( | |||
data_uri: str, dataset: SqlaTable, example_database: Database, session: Session | |||
) -> None: | |||
from superset import conf |
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.
Use current_app.config here
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.
Cool!
@@ -137,7 +139,7 @@ def load_data( | |||
df[column_name] = pd.to_datetime(df[column_name]) | |||
|
|||
# reuse session when loading data if possible, to make import atomic | |||
if example_database.sqlalchemy_uri == get_example_database().sqlalchemy_uri: | |||
if example_database.sqlalchemy_uri == conf.get("SQLALCHEMY_DATABASE_URI"): |
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 think you should check if they're the same OR the examples URI is null, as the loader logic uses the main URI as a fallback
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.
example_database.sqlalchemy_uri
will be set to SQLALCHEMY_DATABASE_URI
if SQLALCHEMY_EXAMPLES_URI
is not set, so this should catch it, no?
Codecov Report
@@ Coverage Diff @@
## master #12702 +/- ##
==========================================
- Coverage 66.93% 63.85% -3.08%
==========================================
Files 1019 487 -532
Lines 49824 30017 -19807
Branches 4877 0 -4877
==========================================
- Hits 33350 19168 -14182
+ Misses 16351 10849 -5502
+ Partials 123 0 -123
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
* fix(load_examples): better fix for load_data * Address changes (cherry picked from commit 9a159b3)
SUMMARY
Revert #12351, while fixing the problem it tried to fix.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TEST PLAN
Ran
superset load-examples
, data was loaded into the examples DB and dashboards work.ADDITIONAL INFORMATION