DataProbe Engine

Updated at:

This topic describes the DataProbe Engine of the PolarDB for PostgreSQL knowledge platform, including instructions for managing datasets, semantic modeling, knowledge base enhancement, and Data Q&A.

Overview

DataProbe is designed for structured data analysis scenarios. You can connect to a business database and synchronize table schemas, column information, and table relationships. You can then ask questions in natural language to generate SQL and view query results, charts, and analytical explanations. For information that the database schema cannot express directly, such as business status codes, metric definitions, and column meanings, you can use knowledge base enhancement to improve Data Q&A accuracy.

DataProbe includes the following core concepts:

Concept

Description

Dataset

A connection configuration that DataProbe uses to access a business database. A dataset corresponds to the business data in one database or in a specified schema.

Semantic model

Tables, columns, column types, and table relationships synchronized from a dataset. This information helps the system understand natural-language questions and generate SQL.

SQL Pairs

Example pairs of natural-language questions and SQL statements, suitable for high-frequency queries with fixed criteria.

Instructions

Business rules, metric definitions, column meanings, or status code descriptions, suitable for supplementing global business context.

Data Q&A

Converts natural-language questions into SQL and returns query results based on the semantic model and knowledge base enhancements.

A typical DataProbe workflow is as follows:

  1. Create a dataset.

  2. Synchronize a semantic model.

  3. Configure SQL Pairs or Instructions.

  4. Start a Data Q&A session and review the results.

Datasets

A dataset stores the connection information that DataProbe needs to access a business database. After you create a dataset, DataProbe can read the table schemas in the specified database and schema.

Create a dataset

  1. In the left-side navigation pane, choose DataProbe > Datasets.

  2. Click New dataset.

  3. Configure the data source connection information. The following table describes the parameters:

    Parameter

    Description

    Example

    Dataset name

    The display name of the dataset.

    Sales Demo

    Database type

    The data source type.

    PostgreSQL, PolarDB PostgreSQL

    Host

    The database endpoint.

    pc-xxxxx.polardbpg.rds.aliyuncs.com

    Port

    The database port.

    5432

    Database

    The name of the database to connect to.

    sales_demo

    Username

    The database username.

    postgres

    Password

    The database password.

    ********

    Schema

    The schema to synchronize.

    sales

  4. Click Create.

  5. In the dataset list, click Test to verify that the connection succeeds.

Note

(Recommended) Configure a read-only database account for DataProbe to avoid accidental operations on business data.

Manage datasets

In the dataset list, you can view, edit, or delete existing datasets. Deleting a dataset removes its connection configuration and related semantic information from DataProbe, but does not delete the raw data in the business database.

Semantic modeling

Semantic modeling synchronizes tables, columns, and relationships from a database to DataProbe. After synchronization, the system can understand user questions based on the semantic model and generate the corresponding SQL.

Synchronize a semantic model

  1. In the left-side navigation pane, choose DataProbe > Semantic modeling.

  2. Select the target dataset.

  3. Click Sync schema or Sync semantic model.

  4. View the synchronized tables, columns, and relationship information.

After synchronization, check the following:

  • Whether the business tables in the target schema are displayed.

  • Whether the column names and column types are correct.

  • Whether the table relationships match business expectations.

Note

If tables or columns are added, deleted, or modified in the business database, resynchronize the semantic model.

Knowledge base enhancement

Knowledge base enhancement supplements business knowledge that the database schema cannot express directly, such as business status codes, metric definitions, column meanings, and common query patterns. DataProbe supports the following two enhancement methods:

Method

Description

Applicable scenarios

SQL Pairs

Maintain example pairs of natural-language questions and SQL statements.

High-frequency queries, fixed statistical criteria, and standard report questions.

Instructions

Maintain business rules, metric definitions, status code descriptions, or column meanings.

Business context such as net sales, valid orders, and status code mappings.

SQL Pairs versus Instructions

Choose an enhancement method based on the stability of the business question:

  • If the question and SQL are largely fixed, use SQL Pairs. SQL Pairs are suitable for retaining high-frequency queries, standard report queries, and queries with fixed statistical criteria.

  • If the question involves an explanation of business context, use Instructions. Instructions are suitable for supplementing status codes, metric definitions, column meanings, and table relationship descriptions.

  • If the same business context affects multiple questions, configure it as a global instruction. A global instruction participates in Q&A as general business knowledge.

  • If you want a rule to apply only to specific questions, configure it as a non-global instruction and bind the applicable questions.

Add SQL Pairs

  1. In the left-side navigation pane, choose DataProbe > Knowledge base.

  2. Select the SQL Pairs tab and click Add.

  3. Configure the following parameters:

    Parameter

    Description

    Question

    A natural-language question that a user might enter.

    SQL

    The standard SQL that corresponds to the question.

  4. Click Save.

Add an instruction

  1. In the left-side navigation pane, choose DataProbe > Knowledge base.

  2. Select the Instructions tab and click Add instruction.

  3. Configure the following parameters:

    Parameter

    Description

    Example

    Instruction content

    Business rules, metric definitions, or status code descriptions.

    S10 indicates a valid revenue order, S20 indicates a refund order, and S90 indicates an invalid order.

    Global instruction

    When enabled, the instruction applies to related Q&A sessions.

    Enabled

    Applicable questions

    A non-global instruction can be bound to selected questions for more precise triggering.

    What are the net sales for each city?

  4. Click Save.

Data Q&A

Data Q&A lets you query structured data in natural language. The system generates SQL based on the synchronized semantic model, SQL Pairs, and Instructions, runs the query, and returns the results.

Start a Data Q&A session

  1. In the left-side navigation pane, choose DataProbe > Data Q&A.

  2. Select the target dataset.

  3. Enter a business question in the input box.

  4. Click Send.

  5. View the answer, SQL, data, and chart results.

The results area contains the following information:

Section

Description

Answer

A natural-language explanation generated from the query results.

SQL

The SQL that the system generates and runs.

Data

The tabular results returned by the SQL query.

Chart

A visualization generated from the query results.

Thinking process

Shows the process of understanding the question, retrieving the model, and generating SQL.

Review Q&A results

If the answer does not meet business expectations, troubleshoot in the following order:

  1. Check whether the generated SQL matches the statistical criteria.

  2. Check whether the tables, columns, and relationships in the semantic model are correct.

  3. Check whether SQL Pairs or Instructions need to be added.

  4. Confirm that the data in the business database meets the query conditions.

The following table lists common issues and recommended actions:

Issue

Possible cause

Recommended action

Connection failure

The data source endpoint, port, account, password, or network settings are incorrect.

Check the dataset connection information, and confirm that the database account has permissions to access the target database and schema.

Tables cannot be synchronized

The schema is configured incorrectly, or the database account does not have permission to read table schemas.

Check the schema configuration in the dataset, and confirm that the target business tables exist and that the account has metadata read permissions.

SQL cannot be generated

The semantic model is not synchronized, or the tables and columns in the question are not identified.

Resynchronize the semantic model and confirm that the target business tables are displayed.

Empty query result

The SQL filter conditions do not match the business data, or the business context in the question is not specified.

Review the SQL and Data tabs to confirm that the filter conditions are correct.

Results do not match business expectations

Status codes, metric definitions, or column meanings are not specified.

Add Instructions in the knowledge base, or configure SQL Pairs for high-frequency questions.

SQL execution failure

The table name, column name, schema, or database permissions are incorrect.

Check the dataset connection information, schema configuration, and database account permissions.

The chart does not match expectations

The query result columns are not suitable for the current chart type.

Adjust the question description, or review the Data tab to confirm the returned columns.

When you troubleshoot Data Q&A issues, review the SQL tab first. The SQL helps determine whether the issue is with semantic understanding, business context, or the underlying data.

Permissions and security

You must log on to access DataProbe pages and APIs. If you access a DataProbe page without logging on, you are redirected to the login page. Requests to DataProbe APIs without valid authentication information are rejected.

When DataProbe accesses a business database, it uses the database account configured in the dataset. To reduce security risks, follow these principles:

  • Use a read-only account to connect to the business database.

  • Authorize DataProbe to access only the databases and schemas that need to be analyzed.

  • Do not enter sensitive information in dataset names, Instructions, or SQL Pairs.

  • If the business database permissions change, retest the dataset connection.

  • Deleting a DataProbe dataset removes only the platform-side connection configuration and related semantic information. It does not delete the raw data in the business database.

Best practices

  • Resynchronize the semantic model when the business database schema changes.

  • Configure SQL Pairs for high-frequency questions with fixed criteria.

  • Configure Instructions for business knowledge such as status codes, metric definitions, and column meanings.

  • Use a read-only account to connect to the business database to reduce data security risks.