Knowledge base management

Updated at:
Copy as MD

The knowledge base provides the semantic foundation for Meta Agent to convert natural language into SQL (NL2SQL) during data asset Q&A. This topic describes how to add, manage, and maintain knowledge entries in the Meta Agent knowledge base.

Background

The knowledge base stores and manages semantic knowledge about your databases. It helps the data asset Q&A feature understand the mapping between natural language and database objects. The richer and more accurate the knowledge entries, the higher the quality of SQL queries that Meta Agent generates.

The knowledge base supports two types of knowledge entries:

Type

Description

Example

SQL record

A complete mapping between a natural language question and its SQL query. When a user asks a similar question, data asset Q&A can reference the existing SQL record to generate the query.

Question: "List the top 10 products by sales this month"
SQL: SELECT product_name, SUM(amount) ... ORDER BY ... LIMIT 10















Fragment knowledge

Semantic descriptions of database tables, columns, or business concepts. Fragment knowledge helps data asset Q&A understand how business terms correspond to database objects.

"VIP customer" refers to records in the customer table where the level column value is 3 or 4.

Knowledge sources

You can build the knowledge base through the following methods:

  • Q&A feedback: When a user clicks the thumbs-up icon (positive feedback) on a generated SQL result during data asset Q&A, the question-answer pair is automatically saved as an SQL record.

  • Manual entry: Add SQL records or fragment knowledge manually to capture business rules and query patterns accumulated by your team.

  • Auto-generation from SQL history: Meta Agent can analyze historical SQL execution logs of a database, identify frequently used query patterns, and generate knowledge entries automatically.

  • CSV bulk import: Organize existing knowledge into a CSV file and import entries in bulk. This is ideal for migrating knowledge from other systems or initializing the knowledge base at scale.

Prerequisites

  • AI-Native Database Service is activated and Meta Agent is purchased.

  • The target database instance is registered in AI-Native Database Service. For more information, see Add and manage data sources.

  • Complete asset discovery so that the system obtains basic metadata. This step is recommended but not required.

Add knowledge

  1. Log on to the AI-Native Database Service console.

  2. In the left-side navigation pane, in the AI Data Assets section, click Meta Agent.

  3. At the bottom of the Meta Agent page, click the Recent Knowledge tab.

  4. Above the knowledge list, click Add Knowledge. In the dialog box that appears, select a knowledge type and specify the required information:

    • Add SQL record: Enter a natural language question and the corresponding SQL statement. The system automatically parses the tables and columns referenced in the SQL statement.

    • Add fragment knowledge: Enter a business description that explains business terms, column semantics, or query rules.

  5. (Optional) Add tags to the knowledge entry for categorization and retrieval.

  6. Click OK.

Manage knowledge entries

The Recent Knowledge tab provides the following management operations for existing knowledge entries:

Operation

Description

Edit

Modify the content, tags, or associated information of a knowledge entry. Click the Edit icon on the right side of the entry.

Delete

Delete obsolete or incorrect knowledge entries. Both individual and bulk deletion are supported.

Tag management

Add, modify, or remove tags from knowledge entries. Tags help you organize knowledge by business domain or data category.

CSV import

Import knowledge entries in bulk by uploading a CSV file. The CSV file must contain required fields such as knowledge type, question description, SQL content, or fragment description.

Bulk operations

Select multiple knowledge entries to perform bulk deletion, bulk tagging, or bulk status changes.

Best practices

To improve the query accuracy of data asset Q&A, follow these knowledge base management practices:

  • Prioritize high-frequency scenarios: Start by adding SQL records and business term descriptions for the most frequently used query scenarios in your team.

  • Leverage Q&A feedback: Encourage team members to give positive feedback (thumbs-up) to accurate query results during data asset Q&A sessions. This allows high-quality SQL queries to be automatically saved as knowledge.

  • Define business term mappings: Use fragment knowledge to define how business terms correspond to database objects. For example, define "active user" as records that satisfy the condition last_login_time > DATE_SUB(NOW(), INTERVAL 30 DAY).

  • Maintain the knowledge base regularly: As your business evolves and database schemas change, review and update knowledge entries periodically. Delete outdated or inaccurate entries.

  • Use tags for classification: Organize knowledge by business domain, such as transactions, users, or products, to simplify maintenance and retrieval.

Note

Knowledge entries serve only as reference material for data asset Q&A to generate SQL queries. They do not directly modify data or schemas in your databases.