MSSQL.schema_exists¶
- MSSQL.schema_exists(schema_name)[source]¶
Check whether a schema exists.
- Parameters:
schema_name (str) – Name of the schema to check.
- Returns:
Whether the schema exists.
- Return type:
bool
Examples:
>>> from pyhelpers.dbms import MSSQL >>> testdb = MSSQL(database_name='testdb') Creating a database: [testdb] ... Done. Connecting <server_name>@localhost:1433/testdb ... Successfully. >>> testdb.schema_exists('dbo') True >>> testdb.schema_exists('test_schema') # (if the schema [test_schema] does not exist) False >>> testdb.drop_database(verbose=True) # Delete the database [testdb] To drop the database [testdb] from <server_name>@localhost:1433 ? [No]|Yes: yes Dropping [testdb] ... Done.