class_docstr: User-facing catalog API, accessible through `SparkSession.catalog`.
  
  This is a thin wrapper around its Scala implementation org.apache.spark.sql.catalog.Catalog.
  
  .. versionchanged:: 3.4.0
      Supports Spark Connect.
class_docstr_tok: ["User-facing","catalog","API",",","accessible","through","`","SparkSession.catalog","`",".","This","is","a","thin","wrapper","around","its","Scala","implementation","org.apache.spark.sql.catalog.Catalog",".","..","versionchanged",":",":","3.4.0","Supports","Spark","Connect","."]
docstr: Creates a table based on the dataset in a data source.
  
  .. versionadded:: 2.2.0
  
  Parameters
  ----------
  tableName : str
      name of the table to create.
  
      .. versionchanged:: 3.4.0
         Allow ``tableName`` to be qualified with catalog name.
  
  path : str, optional
      the path in which the data for this table exists.
      When ``path`` is specified, an external table is
      created from the data at the given path. Otherwise a managed table is created.
  source : str, optional
      the source of this table such as 'parquet, 'orc', etc.
      If ``source`` is not specified, the default data source configured by
      ``spark.sql.sources.default`` will be used.
  schema : class:`StructType`, optional
      the schema for this table.
  description : str, optional
      the description of this table.
  
      .. versionchanged:: 3.1.0
          Added the ``description`` parameter.
  
  **options : dict, optional
      extra options to specify in the table.
  
  Returns
  -------
  :class:`DataFrame`
      The DataFrame associated with the table.
  
  Examples
  --------
  Creating a managed table.
  
  >>> _ = spark.catalog.createTable("tbl1", schema=spark.range(1).schema, source='parquet')
  >>> _ = spark.sql("DROP TABLE tbl1")
  
  Creating an external table
  
  >>> import tempfile
  >>> with tempfile.TemporaryDirectory() as d:
  ...     _ = spark.catalog.createTable(
  ...         "tbl2", schema=spark.range(1).schema, path=d, source='parquet')
  >>> _ = spark.sql("DROP TABLE tbl2")
docstr_tok: ["Creates","a","table","based","on","the","dataset","in","a","data","source",".","..","versionadded",":",":","2.2.0","Parameters","--","--","--","--","--","tableName",":","str","name","of","the","table","to","create",".","..","versionchanged",":",":","3.4.0","Allow","``","tableName","``","to","be","qualified","with","catalog","name",".","path",":","str",",","optional","the","path","in","which","the","data","for","this","table","exists",".","When","``","path","``","is","specified",",","an","external","table","is","created","from","the","data","at","the","given","path",".","Otherwise","a","managed","table","is","created",".","source",":","str",",","optional","the","source","of","this","table","such","as","'parquet",",","'orc","'",",","etc",".","If","``","source","``","is","not","specified",",","the","default","data","source","configured","by","``","spark.sql.sources.default","``","will","be","used",".","schema",":","class",":","`","StructType","`",",","optional","the","schema","for","this","table",".","description",":","str",",","optional","the","description","of","this","table",".","..","versionchanged",":",":","3.1.0","Added","the","``","description","``","parameter",".","*","*","options",":","dict",",","optional","extra","options","to","specify","in","the","table",".","Returns","--","--","--","-",":","class",":","`","DataFrame","`","The","DataFrame","associated","with","the","table",".","Examples","--","--","--","--","Creating","a","managed","table",".",">",">",">","_","=","spark.catalog.createTable","(","``","tbl1","''",",","schema=spark.range","(","1",")",".schema",",","source='parquet","'",")",">",">",">","_","=","spark.sql","(","``","DROP","TABLE","tbl1","''",")","Creating","an","external","table",">",">",">","import","tempfile",">",">",">","with","tempfile.TemporaryDirectory","(",")","as","d",":","...","_","=","spark.catalog.createTable","(","...","``","tbl2","''",",","schema=spark.range","(","1",")",".schema",",","path=d",",","source='parquet","'",")",">",">",">","_","=","spark.sql","(","``","DROP","TABLE","tbl2","''",")"]
code: def createTable(
      self,
      tableName: str,
      path: Optional[str] = None,
      source: Optional[str] = None,
      schema: Optional[StructType] = None,
      description: Optional[str] = None,
      **options: str,
  ) -> DataFrame:
      """Creates a table based on the dataset in a data source.
  
      .. versionadded:: 2.2.0
  
      Parameters
      ----------
      tableName : str
          name of the table to create.
  
          .. versionchanged:: 3.4.0
             Allow ``tableName`` to be qualified with catalog name.
  
      path : str, optional
          the path in which the data for this table exists.
          When ``path`` is specified, an external table is
          created from the data at the given path. Otherwise a managed table is created.
      source : str, optional
          the source of this table such as 'parquet, 'orc', etc.
          If ``source`` is not specified, the default data source configured by
          ``spark.sql.sources.default`` will be used.
      schema : class:`StructType`, optional
          the schema for this table.
      description : str, optional
          the description of this table.
  
          .. versionchanged:: 3.1.0
              Added the ``description`` parameter.
  
      **options : dict, optional
          extra options to specify in the table.
  
      Returns
      -------
      :class:`DataFrame`
          The DataFrame associated with the table.
  
      Examples
      --------
      Creating a managed table.
  
      >>> _ = spark.catalog.createTable("tbl1", schema=spark.range(1).schema, source='parquet')
      >>> _ = spark.sql("DROP TABLE tbl1")
  
      Creating an external table
  
      >>> import tempfile
      >>> with tempfile.TemporaryDirectory() as d:
      ...     _ = spark.catalog.createTable(
      ...         "tbl2", schema=spark.range(1).schema, path=d, source='parquet')
      >>> _ = spark.sql("DROP TABLE tbl2")
      """
      if path is not None:
          options["path"] = path
      if source is None:
          c = self._sparkSession._jconf
          source = c.defaultDataSourceName()
      if description is None:
          description = ""
      if schema is None:
          df = self._jcatalog.createTable(
              tableName, source, description, options
          )
      else:
          if not isinstance(schema, StructType):
              raise PySparkTypeError(
                  error_class="NOT_STRUCT",
                  message_parameters={
                      "arg_name": "schema",
                      "arg_type": type(schema).__name__,
                  },
              )
          scala_datatype = self._jsparkSession.parseDataType(
              schema.json()
          )
          df = self._jcatalog.createTable(
              tableName, source, scala_datatype, description, options
          )
      return DataFrame(df, self._sparkSession)
  
imports: import sys
  import warnings
  from typing import Any, Callable, NamedTuple, List, Optional, TYPE_CHECKING
  from pyspark.errors import PySparkTypeError
  from pyspark.storagelevel import StorageLevel
  from pyspark.sql.dataframe import DataFrame
  from pyspark.sql.session import SparkSession
  from pyspark.sql.types import StructType
label_desc: Use image node_id 18 for calling the Catalog obj's underlying member method code with example usage: obj.createTable(tableName, path, source, schema, description) and returns: DataFrame