pyspark.sql.Catalog.createTable

Catalog.createTable(tableName: str, path: Optional[str] = None, source: Optional[str] = None, schema: Optional[pyspark.sql.types.StructType] = None, description: Optional[str] = None, **options: str) → pyspark.sql.dataframe.DataFrame[source]

Creates a table based on the dataset in a data source.

It returns the DataFrame associated with the table.

The data source is specified by the source and a set of options. If source is not specified, the default data source configured by spark.sql.sources.default will be used. When path is specified, an external table is created from the data at the given path. Otherwise a managed table is created.

Optionally, a schema can be provided as the schema of the returned DataFrame and created table.

New in version 2.2.0.

Returns
DataFrame

Changed in version 3.1: Added the description parameter.