class_docstr: A base class for data sources.
  
  This class represents a custom data source that allows for reading from and/or
  writing to it. The data source provides methods to create readers and writers
  for reading and writing data, respectively. At least one of the methods ``reader``
  or ``writer`` must be implemented by any subclass to make the data source either
  readable or writable (or both).
  
  After implementing this interface, you can start to load your data source using
  ``spark.read.format(...).load()`` and save data using ``df.write.format(...).save()``.
  
  .. versionadded: 4.0.0
docstr: Returns the schema of the data source.
  
  It can refer any field initialized in the ``__init__`` method to infer the
  data source's schema when users do not explicitly specify it. This method is
  invoked once when calling ``spark.read.format(...).load()`` to get the schema
  for a data source read operation. If this method is not implemented, and a
  user does not provide a schema when reading the data source, an exception will
  be thrown.
  
  Returns
  -------
  schema : StructType or str
      The schema of this data source or a DDL string represents the schema
  
  Examples
  --------
  Returns a DDL string:
  
  >>> def schema(self):
  ...    return "a INT, b STRING"
  
  Returns a StructType:
  
  >>> def schema(self):
  ...   return StructType().add("a", "int").add("b", "string")
code: def schema(self) -> Union[StructType, str]:
      """
      Returns the schema of the data source.
  
      It can refer any field initialized in the ``__init__`` method to infer the
      data source's schema when users do not explicitly specify it. This method is
      invoked once when calling ``spark.read.format(...).load()`` to get the schema
      for a data source read operation. If this method is not implemented, and a
      user does not provide a schema when reading the data source, an exception will
      be thrown.
  
      Returns
      -------
      schema : StructType or str
          The schema of this data source or a DDL string represents the schema
  
      Examples
      --------
      Returns a DDL string:
  
      >>> def schema(self):
      ...    return "a INT, b STRING"
  
      Returns a StructType:
  
      >>> def schema(self):
      ...   return StructType().add("a", "int").add("b", "string")
      """
      raise PySparkNotImplementedError(
          error_class="NOT_IMPLEMENTED",
          message_parameters={"feature": "schema"},
      )
  
imports: from abc import ABC, abstractmethod
  from collections import UserDict
  from typing import Any, Dict, Iterator, List, Sequence, Tuple, Type, Union, TYPE_CHECKING
  from pyspark.sql import Row
  from pyspark.sql.types import StructType
  from pyspark.errors import PySparkNotImplementedError
label_desc: Use image node_id 3 for calling the DataSource obj's underlying member method code with example usage: obj.schema() without return types