MSSQL.get_database_names

MSSQL.get_database_names(names_only=True)[source]

Get names of all existing databases.

Parameters:

names_only (bool) – Whether to return only the names of the databases; defaults to True.

Returns:

Names of all existing databases.

Return type:

list | pandas.DataFrame

Examples:

>>> from pyhelpers.dbms import MSSQL
>>> mssql = MSSQL(verbose=True)
Connecting <server_name>@localhost:1433/master ... Successfully.
>>> mssql.get_database_names()
['master', 'tempdb', 'model', 'msdb']