pyspark.sql.SQLContext.tables#

SQLContext.tables(dbName=None)[source]#

Returns a DataFrame containing names of tables in the given database.

If dbName is not specified, the current database will be used.

The returned DataFrame has two columns: tableName and isTemporary (a column with BooleanType indicating if a table is a temporary one or not).

Added in version 1.3.0.

Parameters:
dbName: str, optional

name of the database to use.

Returns:
DataFrame

Examples

>>> sqlContext.registerDataFrameAsTable(df, "table1")
>>> df2 = sqlContext.tables()
>>> df2.filter("tableName = 'table1'").first()
Row(namespace='', tableName='table1', isTemporary=True)