All Products
Search
Document Center

Dataphin:Create a real-time dataset through MySQL

Last Updated:Jan 21, 2025

Dataphin allows you to process MySQL data source table fields using SQL to define dataset metrics. This guide will show you how to create and configure a real-time dataset using MySQL.

Prerequisites

  • Ensure you have created the tag project to which the dataset will belong. For more information, see Create a Tag Project.

  • Create a MySQL data source before setting up a real-time dataset. For detailed instructions, see Create a MySQL Data Source.

Procedure

  1. Navigate to the Dataphin home page and click Tag > Tag Workbench in the top menu bar.

  2. To open the Add Real-time Dataset dialog box, please follow the operation guide below.

    Select Tag Project > click Real-time Dataset > click Add Dataset.

    image

  3. In the Add Real-time Dataset dialog box, select MySQL Dataset.

  4. On the Add MySQL configuration page, fill in the basic information for the dataset.

    Parameter

    Description

    Dataset Name

    Input the dataset name, which can include Chinese and English characters, numbers, and underscores (_), up to 64 characters.

    Dataset Code

    Enter a unique identifier for the dataset, which must begin with a letter and can include lowercase letters, numbers, and underscores (_), up to 64 characters.

    Owner

    Select the dataset's owner.

    Description

    Provide a brief description of the dataset, up to 1000 characters.

  5. Set up the Processing Logic for the dataset.

    Parameter

    Description

    Data Source

    Choose the MySQL data source needed for the dataset.

    Processing Logic (SQL)

    Input the SQL processing logic after selecting the data source.

    • The SELECT statement in SQL must include a field as the input parameter for the real-time tag query service.

    • SQL must contain a variable as the primary key, formatted as ${parameter}.

    • For an example of the configuration, see below:

      SELECT pk, indicatorA, indicatorB FROM source_table where pk = ${parameter}

    Metric Configuration

    After entering the SQL logic, click Metric Parsing to configure the primary key/metric display name, value type, and description based on the parsed fields. Supported value types include string, long integer, double-precision floating-point number, date, Boolean, decimal.

    To configure additional metrics, click +add.

  6. To finalize the dataset creation, click Publish.

    Note

    Once saved successfully, click Authenticate to test your processing logic by entering parameter values as configured.

What to do next

After creating and publishing the real-time dataset, proceed to create real-time tags for it. For detailed steps, see Real-Time Tag Overview.