You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2025/05/28 11:34:53 UTC
(superset) branch 5.0 updated (cfba5cdc57 -> f9ff3259b3)
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a change to branch 5.0
in repository https://gitbox.apache.org/repos/asf/superset.git
from cfba5cdc57 fix: Adjust viz migrations to also migrate the queries object (#33285)
new 00cd069af2 fix: Missing processor context when rendering Jinja (#33596)
new f9ff3259b3 fix: Makes time compare migration more resilient (#33592)
The 2 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.
Summary of changes:
superset/jinja_context.py | 6 ++++++
superset/migrations/shared/migrate_viz/processors.py | 6 ++++--
superset/sql_parse.py | 4 ++--
3 files changed, 12 insertions(+), 4 deletions(-)
(superset) 01/02: fix: Missing processor context when rendering Jinja (#33596)
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a commit to branch 5.0
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 00cd069af2f0f44f0182cddbcc3f157c61caeabe
Author: Michael S. Molina <70...@users.noreply.github.com>
AuthorDate: Tue May 27 16:54:54 2025 -0300
fix: Missing processor context when rendering Jinja (#33596)
(cherry picked from commit ce9759785a840d222f31648c81656b2b380ebb57)
---
superset/jinja_context.py | 6 ++++++
superset/sql_parse.py | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/superset/jinja_context.py b/superset/jinja_context.py
index 4b02a69a75..3bd8a9c2ec 100644
--- a/superset/jinja_context.py
+++ b/superset/jinja_context.py
@@ -590,6 +590,12 @@ class BaseTemplateProcessor:
self._context.update(kwargs)
self._context.update(context_addons())
+ def get_context(self) -> dict[str, Any]:
+ """
+ Returns the current template context.
+ """
+ return self._context.copy()
+
def process_template(self, sql: str, **kwargs: Any) -> str:
"""Processes a sql template
diff --git a/superset/sql_parse.py b/superset/sql_parse.py
index 8fae4507ef..e82e88ea75 100644
--- a/superset/sql_parse.py
+++ b/superset/sql_parse.py
@@ -972,12 +972,12 @@ def extract_tables_from_jinja_sql(sql: str, database: Database) -> set[Table]:
node.data = "NULL"
# re-render template back into a string
- rendered_template = Template(template).render()
+ rendered_sql = Template(template).render(processor.get_context())
return (
tables
| ParsedQuery(
- sql_statement=processor.process_template(rendered_template),
+ sql_statement=processor.process_template(rendered_sql),
engine=database.db_engine_spec.engine,
).tables
)
(superset) 02/02: fix: Makes time compare migration more resilient (#33592)
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a commit to branch 5.0
in repository https://gitbox.apache.org/repos/asf/superset.git
commit f9ff3259b3754a9de21358aea8bc6cce78aa810a
Author: Michael S. Molina <70...@users.noreply.github.com>
AuthorDate: Tue May 27 17:02:10 2025 -0300
fix: Makes time compare migration more resilient (#33592)
(cherry picked from commit b7ba50033a8d57918ab9e55bb56c9ad713044041)
---
superset/migrations/shared/migrate_viz/processors.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/superset/migrations/shared/migrate_viz/processors.py b/superset/migrations/shared/migrate_viz/processors.py
index 9a7b03382b..c60b6bd42f 100644
--- a/superset/migrations/shared/migrate_viz/processors.py
+++ b/superset/migrations/shared/migrate_viz/processors.py
@@ -294,9 +294,11 @@ class TimeseriesChart(MigrateViz):
if (rolling_type := self.data.get("rolling_type")) and rolling_type != "None":
self.data["rolling_type"] = rolling_type
- if time_compare := self.data.get("time_compare"):
+ if (time_compare := self.data.get("time_compare")) is not None:
self.data["time_compare"] = [
- value + " ago" for value in as_list(time_compare) if value
+ v if v.endswith(" ago") else v + " ago"
+ for value in as_list(time_compare)
+ if (v := value.strip())
]
comparison_type = self.data.get("comparison_type") or "values"