Skip to main content

current_database

Returns the current database.

Syntax

Python
from pyspark.sql import functions as sf

sf.current_database()

Examples

Example 1: Get current database

Python
from pyspark.sql import functions as sf
spark.range(1).select(sf.current_database()).show()
Output
+----------------+
|current_schema()|
+----------------+
| default|
+----------------+