class_docstr: A standard ``string.Formatter`` in Python that can understand PySpark instances
  with basic Python objects. This object has to be clear after the use for single SQL
  query; cannot be reused across multiple SQL queries without cleaning.
class_docstr_tok: ["A","standard","``","string.Formatter","``","in","Python","that","can","understand","PySpark","instances","with","basic","Python","objects",".","This","object","has","to","be","clear","after","the","use","for","single","SQL","query",";","can","not","be","reused","across","multiple","SQL","queries","without","cleaning","."]
docstr: Converts the given value into a SQL string.
docstr_tok: ["Converts","the","given","value","into","a","SQL","string","."]
code: def _convert_value(self, val: Any, field_name: str) -> Optional[str]:
      """
      Converts the given value into a SQL string.
      """
      from pyspark import SparkContext
      from pyspark.sql import Column, DataFrame
  
      if isinstance(val, Column):
          assert SparkContext._gateway is not None
  
          gw = SparkContext._gateway
          jexpr = val._jc.expr()
          if is_instance_of(
              gw,
              jexpr,
              "org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute",
          ) or is_instance_of(
              gw,
              jexpr,
              "org.apache.spark.sql.catalyst.expressions.AttributeReference",
          ):
              return jexpr.sql()
          else:
              raise PySparkValueError(
                  error_class="VALUE_NOT_PLAIN_COLUMN_REFERENCE",
                  message_parameters={
                      "val": str(val),
                      "field_name": field_name,
                  },
              )
      elif isinstance(val, DataFrame):
          for df, n in self._temp_views:
              if df is val:
                  return n
          df_name = "_pyspark_%s" % str(uuid.uuid4()).replace("-", "")
          self._temp_views.append((val, df_name))
          val.createOrReplaceTempView(df_name)
          return df_name
      elif isinstance(val, str):
          return lit(val)._jc.expr().sql()  # for escaped characters.
      else:
          return val
  
file_path: spark/python/pyspark/sql/sql_formatter.py
imports: import string
  import typing
  from typing import Any, Optional, List, Tuple, Sequence, Mapping
  import uuid
  from py4j.java_gateway import is_instance_of
  from pyspark.sql.functions import lit
  from pyspark.errors import PySparkValueError
label_desc: Use image node_id 3 for calling the SQLStringFormatter obj's underlying member method code with example usage: obj._convert_value(val, field_name) and returns: jexpr, df_name, lit, val, n