Updated on 2024-10-11 GMT+08:00

OpenGaussQuery

This system keyword is used for select operations on openGauss database. A maximum of 100 result records can be queried in the system.

Parameter

Mandatory

Type

Description

Ip

Yes

String

Database IP address

For a cloud-based GaussDB instance, you need to bind an EIP to the instance and ensure that the security group policy of the instance port is enabled to allow access. For details, see Using gsql to Connect to an Instance.

Port

Yes

Integer

Database port

DB Name

Yes

String

Database instance name

User Name

Yes

String

Username

Password

Yes

String

Password (The login password is personal information and must be defined as sensitive in the environment parameters.)

Sql

Yes

String

SQL query statement

OpenGaussQuery Response

Status: success

Parameter

Type

Description

[Array elements]

Array of row objects

Structure returned by the SQL query result list

Parameter Description

Parameter

Type

Description

field1

String

Database field 1

field2

Integer

Database field 2

...

String

Database field n

OpenGaussQuery Response Example

[ 
    { 
        "name": "XXX", 
        "id": "efdb403066474ab08836b9eeaaa23bca", 
        "age": 18 
    }, 
    { 
        "name": "YYY", 
        "id": "g582b0d966611486f918bedb9c711b14", 
        "age": 20 
    } 
]

OpenGaussQuery Usage Example

Query the database table. A user data list is returned based on the system keyword. You can determine the return based on the service.

Determine the result in the returned list.

Query and collect user data. A user data list is returned.

Determine the result in the response extraction.