Skip to main content

delete_database - Delete a database

The delete_database() method is used to delete a database.

info

This method is only available when using the AdminClient. For more information about the AdminClient, see Admin Client.

Prerequisites

  • You have installed pyseekdb. For more information about how to install pyseekdb, see Quick Start.

  • You have connected to the database. For more information about how to connect to the database, see Admin Client.

  • If you are using server mode of seekdb or OceanBase Database, ensure that the user has the DROP privilege. For more information about how to view the privileges of the current user, see View User Privileges. If the user does not have the privilege, contact the administrator to grant the privilege. For more information about how to directly grant privileges, see Directly Grant Privileges.

Request parameters

delete_database(name,tenant=DEFAULT_TENANT)
ParameterTypeRequiredDescriptionExample Value
namestringYesThe name of the database to be deleted.my_database
tenantstringNo
  • If you are using embedded seekdb or server mode of seekdb, you do not need to specify this parameter.
  • If you are using OceanBase Database, this parameter is required. The default value is sys.
The tenant to which the database belongs.test_tenant

Request example

import pyseekdb

# Embedded mode
admin = pyseekdb.AdminClient(path="./seekdb")

# Delete database
admin.delete_database("my_database")

Response parameters

None

References