Database resources are suitable for helping Agents understand the structure of SQL DataSources, but they do not encourage Agents to freely write SQL. Through ontology graphs and read-only actions, UOSE turns database exploration into a controlled process.Documentation Index
Fetch the complete documentation index at: https://docs.xpertai.cn/llms.txt
Use this file to discover all available pages before exploring further.
Use Cases
Database discovery is suitable for tasks such as:- Find a business table.
- View table fields, types, and comments.
- View primary keys, foreign keys, constraints, and indexes.
- Preview a small amount of data.
- Explain a SELECT query plan.
- Execute row-limited read-only queries.
Recommended Flow
- Register an
xpert_databaseresource. - Set catalog/table allowlists.
- Enable metadata enrichment.
- Complete full sync.
- Search tables or columns in the ontology workspace.
- Use
database.describe_tableto inspect fields and constraints. - Use
database.preview_rowsto preview a small number of rows. - Use
database.explain_queryto inspect the query. - Use
database.query_selectto execute read-only queries.
Understanding Table Structure
Agents should first read:- table name.
- column name.
- data type.
- nullable.
- primary key.
- foreign key.
- index.
- comment.
- row count estimate.
Read-only SQL Boundary
database.query_select allows only one read-only statement. Recommendations:
- Set an explicit limit.
- Select only necessary fields first.
- Avoid full scans of large tables.
- Explain complex queries first.
- Do not execute DDL, DML, CALL, or multiple statements.
Metadata Enrichment
After metadata enrichment is enabled, the system supplements according to the database dialect:- constraints.
- indexes.
- foreign keys.
- check.
- row count estimate.
Security Recommendations
- Set strict allowlists for production databases.
- Limit
maxQueryRows. - Do not write sensitive connection information into the graph.
- Display query results minimally.
- Configure stricter policies for tables that contain sensitive columns.