list_databases - Get the database list
The list_databases() method is used to retrieve the database list in the instance.
info
This API 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.
Request parameters
list_databases(limit=None, offset=None, tenant=DEFAULT_TENANT)
| Parameter | Type | Required | Description | Example value |
|---|---|---|---|---|
limit | int | Optional | The maximum number of databases to return. | 2 |
offset | int | Optional | The number of databases to skip. | 3 |
tenant | string | Optional
| The tenant to which the queried database belongs. | test_tenant |
Request example
# List all databases
import pyseekdb
# Embedded mode
admin = pyseekdb.AdminClient(path="./seekdb")
# list database
databases = admin.list_databases(2,3)
for db in databases:
print(f"Database: {db.name}, Charset: {db.charset}, collation:{db.collation}, metadata:{db.metadata}")
Response parameters
| Parameter | Type | Required | Description | Example value |
|---|---|---|---|---|
name | string | Yes | The name of the queried database. | my_database |
tenant | string | Optional When using embedded seekdb and server mode SeekDB, this parameter is not available. | The tenant to which the queried database belongs. | test_tenant |
charset | string | Optional | The character set of the queried database. | utf8mb4 |
collation | string | Optional | The collation of the queried database. | utf8mb4_general_ci |
metadata | dict | Optional | Reserved field. No data is returned. |
Response example
Database: test, Charset: utf8mb4, collation:utf8mb4_general_ci, metadata:{}
Database: my_database, Charset: utf8mb4, collation:utf8mb4_general_ci, metadata:{}