HyukjinKwon commented on code in PR #37490:
URL: https://github.com/apache/spark/pull/37490#discussion_r944472905
##########
python/pyspark/sql/catalog.py:
##########
@@ -184,38 +234,65 @@ def databaseExists(self, dbName: str) -> bool:
Parameters
----------
dbName : str
- name of the database to check existence
+ name of the database to check existence
+
+ .. versionchanged:: 3.4.0
+ Allow ``dbName`` to be qualified with catalog name.
Returns
-------
bool
Indicating whether the database exists
- .. versionchanged:: 3.4
- Allowed ``dbName`` to be qualified with catalog name.
-
Examples
--------
+ Check if 'test_new_database' database exists
+
>>> spark.catalog.databaseExists("test_new_database")
False
- >>> df = spark.sql("CREATE DATABASE test_new_database")
+ >>> _ = spark.sql("CREATE DATABASE test_new_database")
>>> spark.catalog.databaseExists("test_new_database")
True
+
+ Using the fully qualified name with the catalog name.
+
>>> spark.catalog.databaseExists("spark_catalog.test_new_database")
True
- >>> df = spark.sql("DROP DATABASE test_new_database")
+ >>> _ = spark.sql("DROP DATABASE test_new_database")
"""
return self._jcatalog.databaseExists(dbName)
@since(2.0)
Review Comment:
Yeah, thanks for pointing this out!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]