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: add back database lookup from sip 68 revert #22129

Merged
merged 1 commit into from
Nov 15, 2022

Conversation

eschutho
Copy link
Member

@eschutho eschutho commented Nov 15, 2022

SUMMARY

For the SIP 68 work, we were adding the SqlaTable dataset to the session during the shadow write process. Removing the dual write functionality impacted other unrelated SqlaTable instances that were trying to access the databases during different states of flush. For now, I'm putting back the current functionality until we can look into all of the edge cases here.

Original revert PR: #21986

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

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

data_model = SQLAInterface(SqlaTable, db.session)
query = DatasourceFilter(cls.id_column_name, data_model).apply(query, None)
return query.all()

Copy link
Member Author

Choose a reason for hiding this comment

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

This method was added in to the original PR to eager load the database.

@codecov
Copy link

codecov bot commented Nov 15, 2022

Codecov Report

Merging #22129 (b64c86b) into master (06f87e1) will increase coverage by 0.01%.
The diff coverage is 42.29%.

❗ Current head b64c86b differs from pull request most recent head 8fdb22c. Consider uploading reports for the commit 8fdb22c to get more accurate results

@@            Coverage Diff             @@
##           master   #22129      +/-   ##
==========================================
+ Coverage   66.97%   66.98%   +0.01%     
==========================================
  Files        1832     1832              
  Lines       69905    69918      +13     
  Branches     7570     7570              
==========================================
+ Hits        46820    46838      +18     
+ Misses      21127    21122       -5     
  Partials     1958     1958              
Flag Coverage Δ
hive 52.60% <22.62%> (+0.03%) ⬆️
mysql 78.15% <42.29%> (+0.02%) ⬆️
postgres 78.21% <42.29%> (+0.02%) ⬆️
presto 52.49% <22.62%> (+0.03%) ⬆️
python 81.38% <42.29%> (+0.02%) ⬆️
sqlite 76.67% <42.29%> (+0.02%) ⬆️
unit 50.85% <8.85%> (+0.03%) ⬆️

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 57.64% <0.00%> (-0.69%) ⬇️
superset/db_engine_specs/gsheets.py 75.91% <0.00%> (ø)
superset/examples/bart_lines.py 0.00% <0.00%> (ø)
superset/examples/birth_names.py 71.42% <0.00%> (ø)
superset/examples/country_map.py 0.00% <0.00%> (ø)
superset/examples/energy.py 0.00% <0.00%> (ø)
superset/examples/flights.py 0.00% <0.00%> (ø)
superset/examples/long_lat.py 0.00% <0.00%> (ø)
superset/examples/multiformat_time_series.py 0.00% <0.00%> (ø)
superset/examples/paris.py 0.00% <0.00%> (ø)
... and 23 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@eschutho eschutho changed the title add back database lookup from sip 68 revert fix: add back database lookup from sip 68 revert Nov 15, 2022
@pull-request-size pull-request-size bot added size/M and removed size/L labels Nov 15, 2022
if self.database_id and (
not self.database or self.database.id != self.database_id
):
self.database = session.query(Database).filter_by(id=self.database_id).one()
Copy link
Member Author

Choose a reason for hiding this comment

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

We're adding the database to the model here during flush, so removing this is what caused some issues for existing code that relied on this side effect.

Copy link
Contributor

@eric-briscoe eric-briscoe left a comment

Choose a reason for hiding this comment

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

LGTM

@eschutho eschutho merged commit 6f6cb18 into apache:master Nov 15, 2022
AnushaErrabelli pushed a commit to preset-io/superset that referenced this pull request Nov 15, 2022
jinghua-qa pushed a commit to preset-io/superset that referenced this pull request Nov 18, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 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 preset:2022.45 size/M 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants