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 parse_tag_metadata_in_comments(
      sql_statement: str,
  ) -> CombinedSqlTags:  # noqa: D
      tag_sets: List[SqlRequestTagSet] = []
      extra_tags: List[SqlJsonTag] = []
      for line in sql_statement.split("\n"):
          if line.startswith(SqlStatementCommentMetadata._TAG_PREFIX):
              try:
                  json_str = line[
                      len(SqlStatementCommentMetadata._TAG_PREFIX) :
                  ]
                  tag_sets.append(SqlRequestTagSet.parse_raw(json_str))
              except ValidationError:
                  logger.exception(
                      f"Unable to parse tag metadata from line: {line}"
                  )
  
          if line.startswith(
              SqlStatementCommentMetadata._EXTRA_TAG_PREFIX
          ):
              try:
                  json_str = line[
                      len(
                          SqlStatementCommentMetadata._EXTRA_TAG_PREFIX
                      ) :
                  ]
                  extra_tags.append(SqlJsonTag(json.loads(json_str)))
              except ValidationError:
                  logger.exception(
                      f"Unable to parse extra tag metadata from line: {line}"
                  )
  
      if len(tag_sets) > 1:
          logger.error(
              f"Got multiple tag sets from parsing comments:\n"
              f"{pformat_big_objects(tag_sets)}\n"
              f"Using the first one."
          )
  
      if len(extra_tags) > 1:
          logger.error(
              f"Got multiple extra tags from parsing comments:\n"
              f"{pformat_big_objects(extra_tags)}\n"
              f"Using the first one."
          )
  
      return CombinedSqlTags(
          system_tags=tag_sets[0]
          if len(tag_sets) > 0
          else SqlRequestTagSet(),
          extra_tag=extra_tags[0]
          if len(extra_tags) > 0
          else SqlJsonTag(),
      )
  
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 2 for calling the SqlStatementCommentMetadata obj's underlying member method code with example usage: obj.parse_tag_metadata_in_comments(sql_statement) and returns: CombinedSqlTags