You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by jo...@apache.org on 2023/03/15 23:39:35 UTC
[superset] branch john-bodley--fix-sql-lab-tracking-url created (now 121a9ba4cb)
This is an automated email from the ASF dual-hosted git repository.
johnbodley pushed a change to branch john-bodley--fix-sql-lab-tracking-url
in repository https://gitbox.apache.org/repos/asf/superset.git
at 121a9ba4cb fix(sql-lab): Tracking URL getter/setter
This branch includes the following new commits:
new 121a9ba4cb fix(sql-lab): Tracking URL getter/setter
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[superset] 01/01: fix(sql-lab): Tracking URL getter/setter
Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
johnbodley pushed a commit to branch john-bodley--fix-sql-lab-tracking-url
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 121a9ba4cb785bf9166daeeea0d9b8ad6d1d8845
Author: John Bodley <45...@users.noreply.github.com>
AuthorDate: Thu Mar 16 12:39:24 2023 +1300
fix(sql-lab): Tracking URL getter/setter
---
superset/models/sql_lab.py | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/superset/models/sql_lab.py b/superset/models/sql_lab.py
index f12c8d6c45..c8cc61609b 100644
--- a/superset/models/sql_lab.py
+++ b/superset/models/sql_lab.py
@@ -111,7 +111,7 @@ class Query(
start_running_time = Column(Numeric(precision=20, scale=6))
end_time = Column(Numeric(precision=20, scale=6))
end_result_backend_time = Column(Numeric(precision=20, scale=6))
- tracking_url_raw = Column(Text, name="tracking_url")
+ _tracking_url = Column("tracking_url", Text)
changed_on = Column(
DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=True
@@ -314,12 +314,16 @@ class Query(
@property
def tracking_url(self) -> Optional[str]:
+ return self._tracking_url
+
+ @tracking_url.setter
+ def tracking_url(self, url: str) -> None:
"""
Transfrom tracking url at run time because the exact URL may depends
on query properties such as execution and finish time.
"""
transform = current_app.config.get("TRACKING_URL_TRANSFORMER")
- url = self.tracking_url_raw
+
if url and transform:
sig = inspect.signature(transform)
# for backward compatibility, users may define a transformer function
@@ -327,11 +331,8 @@ class Query(
args = [url, self][: len(sig.parameters)]
url = transform(*args)
logger.debug("Transformed tracking url: %s", url)
- return url
-
- @tracking_url.setter
- def tracking_url(self, value: str) -> None:
- self.tracking_url_raw = value
+
+ self._tracking_url = url
def get_column(self, column_name: Optional[str]) -> Optional[Dict[str, Any]]:
if not column_name: