Skip to content
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

Merged
merged 2 commits into from
Jan 23, 2021

Conversation

betodealmeida
Copy link
Member

@betodealmeida betodealmeida commented Jan 22, 2021

SUMMARY

Revert #12351, while fixing the problem it tried to fix.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TEST PLAN

# superset_config.py
SQLALCHEMY_EXAMPLES_URI = f"mysql://root@localhost/examples"

Ran superset load-examples, data was loaded into the examples DB and dashboards work.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

@@ -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
Copy link
Member

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

Copy link
Member Author

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"):
Copy link
Member

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

Copy link
Member Author

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-io
Copy link

codecov-io commented Jan 22, 2021

Codecov Report

Merging #12702 (794469c) into master (7e77975) will decrease coverage by 3.07%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            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     
Flag Coverage Δ
cypress ?
javascript ?
python 63.85% <0.00%> (-0.30%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/datasets/commands/importers/v1/utils.py 54.79% <0.00%> (-0.77%) ⬇️
superset/sql_validators/postgres.py 50.00% <0.00%> (-50.00%) ⬇️
superset/databases/commands/create.py 83.67% <0.00%> (-8.17%) ⬇️
superset/databases/commands/update.py 85.71% <0.00%> (-8.17%) ⬇️
superset/db_engine_specs/sqlite.py 90.62% <0.00%> (-6.25%) ⬇️
superset/databases/commands/test_connection.py 84.78% <0.00%> (-4.35%) ⬇️
superset/utils/celery.py 96.42% <0.00%> (-3.58%) ⬇️
superset/models/core.py 85.86% <0.00%> (-2.99%) ⬇️
superset/views/core.py 72.82% <0.00%> (-2.48%) ⬇️
superset/db_engine_specs/mysql.py 89.79% <0.00%> (-2.05%) ⬇️
... and 541 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7e77975...2a869a3. Read the comment docs.

@betodealmeida betodealmeida added the need:merge The PR is ready to be merged label Jan 23, 2021
@betodealmeida betodealmeida merged commit 9a159b3 into apache:master Jan 23, 2021
henryyeh pushed a commit to preset-io/superset that referenced this pull request Jan 23, 2021
* fix(load_examples): better fix for load_data

* Address changes

(cherry picked from commit 9a159b3)
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.2.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels need:merge The PR is ready to be merged size/XS 🚢 1.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants