百度智能云

All Product Document

          Distributed Relational Database Service DRDS

          Instructions for Data Table Management Interfaces

          Create Data Table

          Interface description

          This interface is used to create a data table in a certain database of DRDS instance.

          Request structure

          POST /v{version}/instance/{instanceId}/database/{dbName}/table?clientToken={clientToken} HTTP/1.1
          HOST: drds.bj.baidubce.com
          Authorization: authorization string
          {
              "tableDefineList": tableDefineList
          }

          Request header field

          There are no other special header fields except for the common header field.

          Request parameters

          Parameter Name Type Description
          rawsql String Create a database SQL statement. There can be only one SQL statement, and it must end with an English semicolon.
          isDistributed String Single table: "0", distributed table: "1"
          partitionKey String Subtable fields, only fields of varchar and int types are supported
          tabletCount int Number of sub-tables, the value is 64/128/256/512/1024/2048

          Response header field

          There are no other special header fields except for the common header field.

          Response parameter

          No special response parameter

          Request example

          GET https://drds.bj.baidubce.com/v1/instance/drdsuc6qx3cpnh3/database/dbtest/table
          Host: drds.bj.baidubce.com
          Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
          {
              "tableDefineList": [
                  {
                      "rawsql": "create table test(id int);",
                      "isDistributed": "1",
                      "partitionKey": "id",
                      "tabletCount": 128
                  }
              ]
          }

          Response example

          HTTP/1.1 200 OK
          x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
          Content-Type: application/json

          Delete a data table

          Interface description

          This interface is used to delete a data table in a certain database of DRDS instance.

          • The data table status must be Available.

          Request structure

          DELETE /v{version}/instance/{instanceId}/database/{dbName}/table/{tableName} HTTP/1.1
          HOST: drds.bj.baidubce.com
          Authorization: authorization string

          Request header field

          There are no other special header fields except for the common header field.

          Request parameters

          Parameter Name Type Required? Parameter Position Description
          version String Yes URI parameter API version number
          instanceId String Yes URI parameter Instance ID
          dbName String Yes URI parameter Database name
          tableName String Yes URI parameter data table name

          Response header field

          There are no other special header fields except for the common header field.

          Response parameter

          No special response parameter

          Request example

          DELETE https://drds.bj.baidubce.com/v1/instance/drdsuc6qx3cpnh3/database/dbtest/table/test_t
          Host: drds.bj.baidubce.com
          Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de

          Response example

          HTTP/1.1 200 OK
          x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
          Content-Type: application/json

          Query a datatable list

          Interface description

          This interface is used to query the data table list of a certain database of DRDS instance.

          Request structure

          GET /v{version}/instance/{instanceId}/database/{dbName}/table HTTP/1.1
          HOST: drds.bj.baidubce.com
          Authorization authorization string

          Request header field

          There are no other special header fields except for the common header field.

          Request parameters

          Parameter Name Type Required? Parameter Position Description
          version String Yes URI parameter API version number
          instanceId String Yes URI parameter Instance ID
          dbName String Yes URI parameter Database name

          Response header field

          There are no other special header fields except for the common header field.

          Response parameter

          Parameter Name Type Description
          tables List<Table> data table list

          Table

          Parameter Name Type Description
          tableName String data table name
          status String data table status
          partitionMethod String Partition Rule,hash
          partitionKey String Partition Field
          partitionKeyType String Partition Field Type
          isDistributed String Single table: 0, distributed table: 1

          Request example

          GET https://drds.bj.baidubce.com/v1/instance/drdsuc6qx3cpnh3/database/dbtest/table
          Host: drds.bj.baidubce.com
          Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de

          Response example

          HTTP/1.1 200 OK
          x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
          Content-Type: application/json
          {
              "tables": [
                  {
                      "tableName": "test_t",
                      "status": "Available",
                      "isDistributed": "1",
                      "partitionKey": "id",
                      "partitionMethod": "hash",
                      "partitionKeyType": "INT"
                  }
              ]
          }
          Previous
          Instructions for Instance Management Interfaces
          Next
          Instructions for Database Management Interfaces