pyspark.sql.SparkSession.table

SparkSession.table(tableName: str) → pyspark.sql.dataframe.DataFrame

Returns the specified table as a DataFrame.

Returns
DataFrame

Examples

>>> df.createOrReplaceTempView("table1")
>>> df2 = spark.table("table1")
>>> sorted(df.collect()) == sorted(df2.collect())
True