Catalog.
databaseExists
Check if the database with the specified name exists.
New in version 3.3.0.
name of the database to check existence
Indicating whether the database exists
Examples
>>> spark.catalog.databaseExists("test_new_database") False >>> df = spark.sql("CREATE DATABASE test_new_database") >>> spark.catalog.databaseExists("test_new_database") True >>> df = spark.sql("DROP DATABASE test_new_database")