pyspark.sql.SparkSession.table¶
-
SparkSession.
table
(tableName: str) → pyspark.sql.dataframe.DataFrame[source]¶ Returns the specified table as a
DataFrame
.New in version 2.0.0.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters
- tableNamestr
the table name to retrieve.
- Returns
Examples
>>> spark.range(5).createOrReplaceTempView("table1") >>> spark.table("table1").sort("id").show() +---+ | id| +---+ | 0| | 1| | 2| | 3| | 4| +---+