Dataphin supports the parsing of PostgreSQL data source table fields in SQL mode to define dataset metrics. This guide will walk you through the process of creating and configuring a real-time dataset using PostgreSQL.
Prerequisites
Ensure you have created the tag project to which the dataset will belong before proceeding to create a real-time dataset. For more information, see Create a Tag Project.
Create a PostgreSQL data source for the real-time dataset prior to its creation. For detailed instructions, see Create a PostgreSQL Data Source.
Procedure
Navigate to the Dataphin home page, and from the top menu bar, click Tag -> Tag Workbench.
To enter the Add Real-time Dataset dialog box, follow these steps:
Select Tag Project -> click Real-time Dataset -> click Add Dataset.

In the Add Real-time Dataset dialog box, select PostgreSQL Dataset.
On the Add PostgreSQL configuration page, fill in the basic information for the dataset.
Parameter
Description
Dataset Name
Enter the dataset's name, which can include Chinese and English characters, numbers, and underscores (_), and must be within 64 characters.
Dataset Code
Provide a unique identifier for the real-time dataset, which distinguishes it when multiple datasets have the same name. It must begin with a letter and can include lowercase English letters, numbers, and underscores (_), up to 64 characters.
Owner
Select the owner of the real-time dataset.
Description
Provide a brief description of the real-time dataset, up to 1000 characters.
Set up the Processing Logic for the real-time dataset.
Parameter
Description
Data Source
Choose the necessary PostgreSQL data source for processing.
Processing Logic (SQL)
Upon selecting the data source, input the SQL processing logic.
The SELECT statement in SQL must include a field as the input parameter for the real-time tag query service.
Ensure SQL includes a variable as the primary key, formatted as
${parameter}.Here is a configuration example:
SELECT pk, indicatorA, indicatorB FROM source_table where pk = ${parameter}
Metric Configuration
First, select the data source and enter the SQL processing logic. Then, click Metric Parsing to configure the primary key/metric display name, value type, and description based on the parsed field names. Supported value types include string, long integer, double-precision floating-point number, date, Boolean, decimal.
To configure additional metrics, click + Add.
To finalize the creation of the real-time dataset, click Publish.
NoteOnce saved successfully, click Authenticate to input parameter values according to the configured processing logic and verify the correctness of your processing logic.
What to do next
After creating and publishing the real-time dataset, proceed to create corresponding real-time tags. For detailed instructions, see Real-Time Tag Overview.