Updated on 2024-03-15 GMT+08:00

Querying All Tables (Discarded)

Function

This API is used to query information about tables that meet the filtering criteria or all the tables in the specified database.

This API has been discarded and is not recommended.

URI

  • URI format

    GET /v1.0/{project_id}/databases/{database_name}?keyword=tb&with-detail=true

  • Parameter description
    Table 1 URI parameters

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Project ID, which is used for resource isolation. For details about how to obtain its value, see Obtaining a Project ID.

    database_name

    Yes

    Name of the database where the table resides.

    keyword

    No

    Keywords used to filter table names.

    with-detail

    No

    Whether to obtain detailed information about tables (such as owner and size).

Request

None

Response

Table 2 Response parameters

Parameter

Mandatory

Type

Description

is_success

Yes

Boolean

Whether the request is successfully executed. Value true indicates that the request is successfully executed.

message

Yes

String

System prompt. If execution succeeds, the parameter setting may be left blank.

table_count

Yes

Integer

Total number of tables.

tables

Yes

Array of objects

Table information. For details, see Table 3.

Table 3 tables parameters

Parameter

Mandatory

Type

Description

create_time

Yes

Long

Time when a table is created. The timestamp is expressed in milliseconds.

data_type

No

String

Type of data in the OBS table. Currently, the parameter value can be parquet, ORC, CSV, or JSON. This parameter is valid only for OBS tables.

data_location

Yes

String

Data storage location. OBS tables, DLI tables, and views are available.

last_access_time

Yes

Long

Time when the table was last updated. The timestamp is expressed in milliseconds.

location

No

String

Storage path on the OBS table.

owner

Yes

String

Table owner.

table_name

Yes

String

Name of a table.

table_size

Yes

Long

Size of a DLI table. Set this parameter to 0 for non-DLI tables.

table_type

Yes

String

Type of a table.

  • EXTERNAL: Indicates an OBS table.
  • MANAGED: Indicates a DLI table.
  • VIEW: Indicates a view.

partition_columns

No

Array of Strings

Partition field. This parameter is valid only for OBS partition tables.

If with-detail is set to false in the URI, only values of parameters data_location, table_name, and table_type are returned.

Example

  • Example request
    None
  • Example response (successful request)
    {
      "is_success": true,
      "message": "",
      "table_count": 1,
      "tables": [
        { "create_time":1517364268000,
          "data_location":"OBS",
          "data_type":"csv",
          "last_access_time":1517364268000,
          "location":"obs://DLI/sqldata/data.txt",
          "owner":"test",
          "partition_columns": ["a0"],
          "table_name":"obs_t",
          "table_size":0,
          "table_type":"EXTERNAL"
        }
      ]
    }

    If an error occurs when this API is invoked, the system does not return the result similar to the preceding example, but returns the error code and error information. For details, see Error Codes.