class_docstr: Helps to add a comment to SQL statements to encode metadata (e.g. tags).
  
  Added at the end as some engines remove leading comments:
  https://docs.snowflake.com/en/release-notes/2017-04.html#queries-leading-comments-removed-during-execution
  
  Example:
      SELECT 1
  ->
      -- MF_REQUEST_METADATA: {"tag_dict": {"MF_REQUEST_ID": "mf_rid__tmhulwkt"}}
      SELECT 1
class_docstr_tok: ["Helps","to","add","a","comment","to","SQL","statements","to","encode","metadata","(","e.g",".","tags",")",".","Added","at","the","end","as","some","engines","remove","leading","comments",":","https",":","\/\/docs.snowflake.com\/en\/release-notes\/2017-04.html","#","queries-leading-comments-removed-during-execution","Example",":","SELECT","1","-",">","--","MF_REQUEST_METADATA",":","{","``","tag_dict","''",":","{","``","MF_REQUEST_ID","''",":","``","mf_rid__tmhulwkt","''","}","}","SELECT","1"]
code: def add_tag_metadata_as_comment(
      sql_statement: str, combined_tags: CombinedSqlTags
  ) -> str:  # noqa: D
      if combined_tags.system_tags.tags:
          sql_statement = (
              sql_statement
              + "\n"
              + SqlStatementCommentMetadata._TAG_PREFIX
              + combined_tags.system_tags.json()
          )
  
      if combined_tags.extra_tag.json_dict:
          serialized_json: Optional[str] = None
          try:
              serialized_json = json.dumps(
                  combined_tags.extra_tag.json_dict
              )
          except Exception:
              logger.exception(
                  f"Not including extra tag that couldn't be serialized: {combined_tags.extra_tag}\n"
              )
  
          if serialized_json:
              sql_statement = (
                  sql_statement
                  + "\n"
                  + SqlStatementCommentMetadata._EXTRA_TAG_PREFIX
                  + serialized_json
              )
  
      return sql_statement
  
file_path: metricflow/metricflow/sql_request/sql_statement_metadata.py
imports: from __future__ import annotations
  import json
  import logging
  from dataclasses import dataclass, field
  from typing import List, Optional
  from dbt_semantic_interfaces.pretty_print import pformat_big_objects
  from pydantic import ValidationError
  from metricflow.sql_request.sql_request_attributes import SqlJsonTag, SqlRequestTagSet
label_desc: Use image node_id 1 for calling the SqlStatementCommentMetadata obj's underlying member method code with example usage: obj.add_tag_metadata_as_comment(sql_statement, combined_tags) and returns: sql_statement