Vitor-Avila commented on code in PR #27582: URL: https://github.com/apache/superset/pull/27582#discussion_r1533230816
########## superset/jinja_context.py: ########## @@ -722,3 +723,69 @@ def dataset_macro( sqla_query = dataset.get_query_str_extended(query_obj, mutate=False) sql = sqla_query.sql return f"(\n{sql}\n) AS dataset_{dataset_id}" + + +def get_dataset_id_from_context(metric_key: str) -> int: + """ + Retrives the Dataset ID from the request context. + + :param metric_key: the metric key. + :returns: the dataset ID. + """ + # pylint: disable=import-outside-toplevel + from superset.daos.chart import ChartDAO + from superset.views.utils import get_form_data Review Comment: @dpgaspar I tried moving these local imports to the top but they result in circular import errors (even the `get_form_data`. I was only able to move the test imports to the top. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org