code: def sql_query_plan_as_text(sql_query_plan: SqlQueryPlan) -> str:
      """Converts the SQL query plan to a text representation that can be used for tests / debugging.
  
      The text representation is similar to XML.
      """
      component_from_render_node_as_text = sql_query_plan_node_as_text(
          sql_query_plan.render_node
      )
  
      # Under <DataflowPlan>, render all components.
      return jinja2.Template(
          textwrap.dedent(
              """\
              <{{ node_class }}{%- if not inner_contents %}/>{%- else %}>
                  {%- if inner_contents %}
                  {{ inner_contents | indent(4) }}
                  {%- endif %}
              </{{ node_class }}>
              {%- endif %}
              """
          ),
          undefined=StrictUndefined,
      ).render(
          node_class=sql_query_plan.__class__.__name__,
          inner_contents=component_from_render_node_as_text,
      )
  
file_path: metricflow/metricflow/sql/sql_plan_to_text.py
imports: from __future__ import annotations
  import textwrap
  import jinja2
  from jinja2 import StrictUndefined
  from metricflow.dag.dag_to_text import MetricFlowDagToText
  from metricflow.sql.sql_plan import SqlQueryPlan, SqlQueryPlanNode
label_desc: Use image node_id 2 for calling a global function with example usage: sql_query_plan_as_text(sql_query_plan) and returns: jinja2