Creating a Schema
Function
This API is used to create a schema.
URI
POST /v1/{project_id}/instances/{instance_id}/databases
| Parameter | Mandatory | Description |
|---|---|---|
| project_id | Yes | Project ID of a tenant in a region |
| instance_id | Yes | DDM instance ID |
Request
Request parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| databases | Yes | Array | Schema information. For details about the parameters, see Table 3. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Schema name, which: |
| shard_mode | Yes | String | Sharding mode of the schema. The value can be:
|
| shard_number | Yes | Integer | Number of shards in the same sharding mode. The value is the product of the shard_unit value and the number of associated RDS DB instances. |
| shard_unit | Yes | Integer | Number of shards per RDS DB instance
|
| used_rds | Yes | Array | RDS DB instance to be associated with the schema |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| id | Yes | String | ID of the RDS DB instance associated with the schema |
| adminUser | Yes | String | Owner of the associated RDS DB instance |
| adminPassword | Yes | String | Password for logging in to the associated RDS instance |
Response
Response parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| databases | Array | true | Schema information |
| Parameter | Type | Description |
|---|---|---|
| name | String | Schema name |
Example
- Example request
{ "databases": [ { "name": "ljj_833211", "shard_mode": "cluster", "shard_number": 8, "shard_unit": 8, "used_rds": [ { "id": "f296c394f13f48449d715bf99af07e59in01", "adminUser": "root", "adminPassword": "Gauss_234" } ] } ] }
- Example response
{ "databases": [ { "name": "test123" } ] }
Status Code
For details, see Status Codes.
Last Article: APIs for Managing Schemas
Next Article: Querying Schemas

Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.