amaliujia commented on code in PR #37039:
URL: https://github.com/apache/spark/pull/37039#discussion_r912317990
##########
python/pyspark/sql/catalog.py:
##########
@@ -139,11 +140,40 @@ def listDatabases(self) -> List[Database]:
jdb = iter.next()
databases.append(
Database(
- name=jdb.name(), description=jdb.description(),
locationUri=jdb.locationUri()
+ name=jdb.name(),
+ catalog=jdb.catalog(),
+ description=jdb.description(),
+ locationUri=jdb.locationUri(),
)
)
return databases
+ def getDatabase(self, dbName: str) -> Database:
+ """Get the database with the specified name.
+ This throws an AnalysisException when the database cannot be found.
+
+ .. versionadded:: 3.4.0
+
+ Parameters
+ ----------
+ dbName : str
+ name of the database to check existence.
+
+ Examples
+ --------
+ >>> spark.catalog.getDatabase("default")
+ Database(name='default', catalog=None, description='default database',
...
Review Comment:
I was not aware of this though:
Is the `catalog=None` because of current catalog is not set? I am asking
because I thought every DB should have a catalog.
--
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]