Metadata and data query
The data query page is used to confirm data structures, validate SQL and preview results before developing APIs. It reuses the data source connection but exposes read-only capabilities only.
Open the query page
- Go to Data Sources.
- Expand the target data source in the metadata tree on the left.
- Select a database and table, then click the table name.
- The data query page opens on the right and queries the table data by default.
The metadata tree is displayed in three levels:
Data source
└── Database / schema
└── Table / view
└── Column
Query page capabilities
| Capability | Description |
|---|---|
| Table data preview | Loads the current table data by default, with pagination |
| Custom SQL | Write and execute read-only SQL in the editor |
| SQL formatting | Format the current SQL in one click |
| DDL script | View the table DDL to generate query or migration scripts |
| Execution results | Show column names, types and data; long text is truncated automatically |
| Duration and row count | Help assess query performance and result size |
Read-only restrictions
The platform allows only statements that begin with the following (leading whitespace is ignored):
SELECT ...
SHOW ...
DESC ...
DESCRIBE ...
EXPLAIN ...
Other statements (INSERT, UPDATE, DELETE, ALTER, DROP, CREATE, stored procedure calls, etc.) are rejected. This protection is enforced on the data source side and does not rely on frontend validation.
The read-only restriction only guarantees statement type safety; it does not limit the data scope of the query. Configure a least-privilege account for the data source, and control sensitive data through views or row-level permissions.
Result preview
- Query results are displayed page by page; a single preview returns at most 100 rows.
- The table supports horizontal scrolling when there are many columns.
NULL, binary data and very long text are handled according to display rules.- The response structure of non-relational data sources may not be a standard two-dimensional table; the platform converts it to a table where possible.
DDL script
Click DDL script to view the DDL of the current table, to:
- Confirm column types, primary keys, indexes and comments.
- Copy it into SQL mode as a query foundation.
- Compare table structures across environments.
FAQ
| Symptom | Cause | Resolution |
|---|---|---|
| Query rejected | The statement does not start with a read-only prefix | Use SELECT / SHOW / DESC / DESCRIBE / EXPLAIN |
| Metadata is empty | The account has no database or table permission, or the schema selection is wrong | Check account grants and the default schema |
| Connection timeout | Network or database load | Check the firewall, connection pool and database status |
| Query is slow | Missing indexes or a large data volume | Add indexes, restrict conditions, return fewer columns |
| Special character error | The table or column name contains - or another special character | Wrap it in double quotes |
Relationship to API development
SQL validated on the data query page can be copied directly into SQL mode. Note:
- The query page uses the data source account's permissions. APIs use the same data source at runtime but go through parameter binding, pagination and plugin processing.
- The query page does not parse
#{}parameters; write and parse parameter syntax for APIs in SQL mode. - Query page results do not pass through data plugins (filtering, masking, field mapping) and cannot replace final response validation for APIs.