Skip to content

chore: freeze the UUID of examples DB - #15724

Merged
betodealmeida merged 1 commit into
masterfrom
set_examples_db_uuid
Jul 27, 2021
Merged

betodealmeida merged 1 commit into
masterfrom
set_examples_db_uuid

Conversation

@betodealmeida

@betodealmeida betodealmeida commented Jul 15, 2021 •

Copy link
Copy Markdown
Member

SUMMARY

Currently when we run load-examples the examples DB is created with a random UUID. This makes it hard to move across instances datasets/charts/dashboards that reference the examples DB, since the UUID doesn't match.

This PR freezes the UUID of the examples DB.

There's one gotcha. If the user has created the examples DB before this PR, but runs load-examples after this patch we won't find the examples DB by searching for the frozen UUID. Instead, we need to search by name. This is how currently the load-examples process works. I kept the logic for when we can't find the examples DB via the UUID.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Loaded examples:

$ superset load-examples

Then checked the UUID of the examples DB created:

mysql> SELECT uuid FROM dbs;
+------------------------------------+
| uuid                               |
+------------------------------------+
| 0xA2DC77AFE65449BBB32140F6B559A1EE |
+------------------------------------+
1 row in set (0.00 sec)

mysql>

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • 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

@betodealmeida
betodealmeida force-pushed the set_examples_db_uuid branch from b9aff5e to 0a4bc13 Compare July 15, 2021 22:05
python_date_format: null
version: 1.0.0
database_uuid: 566ca280-3da8-967e-4aa4-4b349218736a
database_uuid: a2dc77af-e654-49bb-b321-40f6b559a1ee

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Other datasets inside superset/examples/configs/datasets/examples already had the UUID set to this, so I kept it and updated this one.

@codecov

codecov Bot commented Jul 15, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #15724 (05e82a9) into master (7dd3af6) will increase coverage by 0.02%.
The diff coverage is 71.22%.

❗ Current head 05e82a9 differs from pull request most recent head 83e6e0c. Consider uploading reports for the commit 83e6e0c to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #15724      +/-   ##
==========================================
+ Coverage   76.91%   76.94%   +0.02%     
==========================================
  Files         983      983              
  Lines       51583    51641      +58     
  Branches     6979     6994      +15     
==========================================
+ Hits        39673    39733      +60     
+ Misses      11688    11682       -6     
- Partials      222      226       +4     
Flag Coverage Δ
hive ?
mysql 81.53% <71.87%> (+<0.01%) ⬆️
postgres 81.56% <71.87%> (+<0.01%) ⬆️
presto 81.26% <71.87%> (-0.01%) ⬇️
python 81.82% <71.87%> (-0.27%) ⬇️
sqlite 81.17% <71.87%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...set-frontend/src/dashboard/util/resizableConfig.ts 100.00% <ø> (ø)
...tasourcePanel/DatasourcePanelDragWrapper/index.tsx 100.00% <ø> (ø)
...onalFormattingControl/FormattingPopoverContent.tsx 33.33% <ø> (ø)
...ontrols/DndColumnSelectControl/DndMetricSelect.tsx 44.44% <0.00%> (ø)
...c/views/CRUD/data/database/DatabaseModal/index.tsx 47.57% <0.00%> (ø)
...nd/src/views/CRUD/data/dataset/AddDatasetModal.tsx 56.25% <ø> (ø)
superset/commands/importers/v1/examples.py 38.57% <0.00%> (-2.34%) ⬇️
...nts/controls/DateFilterControl/DateFilterLabel.tsx 66.93% <40.00%> (ø)
...et-frontend/src/components/TableSelector/index.tsx 84.25% <50.00%> (-0.79%) ⬇️
superset/utils/mock_data.py 25.18% <50.00%> (+0.36%) ⬆️
... and 31 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 7dd3af6...83e6e0c. Read the comment docs.

@betodealmeida
betodealmeida requested a review from villebro July 15, 2021 22:39
@betodealmeida
betodealmeida force-pushed the set_examples_db_uuid branch from 0a4bc13 to 02b5057 Compare July 20, 2021 15:40
@betodealmeida
betodealmeida force-pushed the set_examples_db_uuid branch from 02b5057 to 83e6e0c Compare July 20, 2021 16:04
@betodealmeida
betodealmeida merged commit eeba326 into master Jul 27, 2021
EBoisseauSierra added a commit to EBoisseauSierra/superset that referenced this pull request Sep 6, 2021
NB: We're here discussing the `import-dashboards` CLI with the
`VERSIONED_EXPORT` feature flag *turned ON* — cf. apache#11349

Currently, `superset import-dashboards` looks up at the required
databases (`export/databases/*.yaml`).
If the db URI (`sqlalchemy_uri` key) contains a masked password, then
the script looks up for already existing databases record.

The match is currently done using db UUID. However, '<insert how UUIDs
are generated>', the same db connection (same URI) might not have the
same UUID on the export instance, and on the import one. (Cf. apache#16395)

Thus, we propose to lookup for the db _name_ instead — this would also
allow for updating the db URI between the export and the import
instance.

Note: this change should not be propagated for the demo db, as its UUID
has been frozen in apache#15724.

Signed-off-by: Étienne Boisseau-Sierra <[email protected]>
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.0 First shipped in 1.3.0 labels Mar 12, 2024
@mistercrunch
mistercrunch deleted the set_examples_db_uuid branch March 26, 2024 16:20
qfcwell pushed a commit to qfcwell/superset that referenced this pull request May 12, 2026
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 🚢 1.3.0 First shipped in 1.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants