-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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(sql lab): Tracking URL getter/setter #23387
Conversation
Codecov Report
@@ Coverage Diff @@
## master #23387 +/- ##
===========================================
+ Coverage 56.27% 67.57% +11.29%
===========================================
Files 1907 1907
Lines 73495 73494 -1
Branches 7977 7977
===========================================
+ Hits 41356 49660 +8304
+ Misses 30091 21786 -8305
Partials 2048 2048
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 300 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@john-bodley Would we need a migration to transform the previously saved values? |
The original intention was to store the raw url and always transform the url at runtime. This was by design. We need transform at runtime because certain urls expires and we need to return None when they do---this requires runtime information such as current timestamp. Superset administrators can also tweak the transform function from time to time in cases like when they migrate the tracking ui server to a new host name. The original URL would always contain the most original information so it makes more sense to store the original URL in the database. |
@ktmud if that's the case then rather than augmenting the @property
def tracking_url(self) -> Optional[str]:
... to a different property, maybe |
I think I tried that but couldn't figure out how to expose a new property in the FAB API... |
SUMMARY
I'm unclear if #20799 ever stored the correct URL in the database, but it seems like the
query.tracking_url
column is not updated with the transformed URL when the record is persisted to the database.Although the unit tests illustrate the getter/setter behavior (and thus the link in SQL Lab works) it doesn't include a database write and thus it's unclear if SQLAlchemy invokes the getter when serializing a record to the database. Typically the getter should simply return the value whereas the setter should perform the necessary augmentation which is the logic I've implemented here, i.e., the
_tracking_url
column always contains the correct transformed value (if appropriate) whereas previous only thetracking_url
field (proxy) was correct.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
CI. Also tested locally and confirmed that the
tracking_url
which was persisted in the database was correct.ADDITIONAL INFORMATION