Note
Kailangan ng pahintulot para ma-access ang page na ito. Maaari mong subukang mag-sign in o magpalit ng mga direktoryo.
Ang pag-access sa pahinang ito ay nangangailangan ng pahintulot. Maaari mong subukang baguhin ang mga direktoryo.
Returns a list of columns for the given table/view in the specified database.
Syntax
listColumns(tableName: str, dbName: str = None)
Parameters
| Parameter | Type | Description |
|---|---|---|
tableName |
str | Name of the table to list columns. Can be qualified with catalog name when dbName is None. |
dbName |
str, optional | Name of the database to find the table to list columns. |
Returns
list of Column
Notes
The order of arguments here is different from that of its JVM counterpart because Python does not support method overloading.
If no database is specified, the current database and catalog are used. This API includes all temporary views.
Examples
_ = spark.sql("DROP TABLE IF EXISTS tbl1")
_ = spark.sql("CREATE TABLE tblA (name STRING, age INT) USING parquet")
spark.catalog.listColumns("tblA")
# [Column(name='name', description=None, dataType='string', nullable=True, ...
_ = spark.sql("DROP TABLE tblA")