nxcals.api.extraction.data.builders.SparkSession.table
- SparkSession.table(tableName: str) DataFrame
Returns the specified table as a
DataFrame.Added in version 2.0.0.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters:
tableName (str) – the table name to retrieve.
- Return type:
Notes
In Spark Classic, a temporary view referenced in spark.table is resolved immediately, while in Spark Connect it is lazily analyzed. So in Spark Connect if a view is dropped, modified or replaced after spark.table, the execution may fail or generate different results.
Examples
>>> spark.range(5).createOrReplaceTempView("table1") >>> spark.table("table1").sort("id").show() +---+ | id| +---+ | 0| | 1| | 2| | 3| | 4| +---+