> ## Documentation Index
> Fetch the complete documentation index at: https://help.dingtalk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Preparation

> Learn what data preparation is and why it matters in data analysis, including how to configure a data source, create a dataset, process data, and accelerate data. With the services provided by YiDA, you can easily process data and build visual analyses.

Exclusive to the Dedicated edition

## 1. What Is Data Preparation

Before exploring how to use the data preparation feature, let's first look at what data preparation actually is and when you need this premium capability.

YiDA provides data processing, data visualization, and embedded BI services for building data analysis pages. **Data preparation refers to a series of operations performed on a data source or dataset — such as joining multiple tables or transforming data — before visual analysis. It is the step that precedes visual analysis.**

In short, before creating a report and analyzing data, you can first process the data source or dataset.

## 2. How to Configure Data Preparation

### 2.1 Enter Data Preparation

**Path**: Open the app page >> Create report >> Drag a display component >> Select dataset >> Data preparation

Create a report inside an app form

Add a dataset

Data preparation page

After you click Data preparation, the data preparation page opens. Data preparation involves the following steps:

**Configure a data source >> Create a dataset >> Configure and process data fields >> Save >> Accelerate**

### 2.2 Configure a Data Source

In data preparation, there are two ways to upload your data: import local files (Excel/CSV), or connect to a server such as MySQL or a YiDA data source.

**Note**: Data from YiDA apps appears in the first row by default, with the display type shown as YiDA data source.

Configure a data source

Local data import supports Excel and CSV files, as shown below:

Connecting to a server supports importing from databases. Currently, only MySQL and YiDA data sources are supported. To use a YiDA data source, select the corresponding app name.

**Special notes:**

After selecting MySQL, fill in the following fields: Driver, URL, DB Name, User Name, and Password.

The URL format is as follows: **jdbc:mysql://database IP address:database port/database name**

Example: If your MySQL database IP address is 47.96.37.128, the port is 3306, and the database name is aaa, enter: **jdbc:mysql://47.96.37.128:3306/aaa**

### 2.3 Create a Dataset

Two modes are provided: Detail and Summary.

For example, in a detail dataset, you can process your data by adding multiple tables, defining associations, applying formulas, and more.

After processing the data, **remember to save the current configuration rules**.

<Note>
  #### Tips:

  Join is a common operation in database queries, used to combine data from two or more tables based on specified conditions.

  There are four main types of joins: inner join, left join, right join, and full outer join. Examples of how to set up each are provided below.

  ##### Inner join

  * Definition: An inner join returns only the records that satisfy the join condition in both tables.
  * Use case: Use an inner join when you only want records that exist in both tables. For example, given a customer table and an order table, you may want only the records that appear in both.

  ##### Left join

  * Definition: A left join returns all records from the left table, plus the records from the right table that satisfy the join condition. If there is no match in the right table, the corresponding columns are null.
  * Use case: Use a left join when you want every record from the left table to appear in the result set, even if there is no match in the right table. For example, list every customer along with their orders, including customers who have not placed any orders.

  ##### Right join

  * Definition: A right join returns all records from the right table, plus the records from the left table that satisfy the join condition. If there is no match in the left table, the corresponding columns are null.
  * Use case: Similar to a left join, but in the opposite direction. For example, list every order along with the customer information, even when the customer information is missing for some orders.

  ##### Full outer join

  * Definition: A full outer join returns all records from both the left and right tables that satisfy the join condition. When there is no match in either table, the corresponding columns are null.
  * Use case: Use a full outer join when you want all records from both tables regardless of whether a match exists in the other. For example, list every customer and every order, including customers without orders and orders without customer information.
</Note>

### 2.4 Accelerate Data

The final step of data preparation is accelerating your data. After saving, click Accelerate, and the backend automatically selects the acceleration method best suited to your data.

You can also click Log to view the current acceleration progress. Once acceleration completes, preview the data to confirm it matches your expectations.

### 2.5 Report Analysis

Go back to the data analysis editing page and click Refresh. The dataset you just generated is now available in single-table data or multi-table associations.

## 4. FAQ

<AccordionGroup>
  <Accordion id="q1" title="4.1 Why did acceleration fail?">
    Check the acceleration log and scroll to the end to view the failure message.

    ```xml theme={"theme":{"light":"github-light","dark":"github-dark"}}
    [2020-09-03 16:22:35] failed, jobId:T_4b1c7e0a-bd80-44d2-a3fd-0adc12b40387, schemaCode:query_APP_I8PRTK1GTAFLKO5DG4SH_371846, targetSchemaCode:null, tableName:query_APP_I8PRTK1GTAFL_234946_6d60de83d95fb0b96dd2ae1e_069cd3, queryCode:query_APP_I8PRTK1GTAFL_234946_6d60de83d95fb0b96dd2ae1e_069cd3, costTime:59794 error msg:表数据为空异常。详情:Query table:query_APP_I8PRTK1GTAFL_234946_6d60de83d95fb0b96dd2ae1e_069cd3 data size equal zero. cannot be accelerated. , root msg:DataSizeZeroException: 表数据为空异常。详情:Query table:query_APP_I8PRTK1GTAFL_234946_6d60de83d95fb0b96dd2ae1e_069cd3 data size equal zero. cannot be accelerated.
    [2020-09-03 16:22:35] failed, jobId:T_74d02519-ae60-4971-b8db-57f00e8ec0dd, schemaCode:query_APP_I8PRTK1GTAFLKO5DG4SH_371846, targetSchemaCode:null, tableName:query_APP_I8PRTK1GTAFL_234946_6d60de83d95fb0b96dd2ae1e_069cd3, queryCode:query_APP_I8PRTK1GTAFL_234946_6d60de83d95fb0b96dd2ae1e_069cd3, costTime:59820 error msg:表数据为空异常。详情:Query table:query_APP_I8PRTK1GTAFL_234946_6d60de83d95fb0b96dd2ae1e_069cd3 data size equal zero. cannot be accelerated. , root msg:DataSizeZeroException: 表数据为空异常。详情:Query table:query_APP_I8PRTK1GTAFL_234946_6d60de83d95fb0b96dd2ae1e_069cd3 data size equal zero. cannot be accelerated.
    [2020-09-03 16:22:35] failed, jobId:T_MAIN_bf7181fd-6a79-43f2-a5d8-d133751c3880, schemaCode:query_APP_I8PRTK1GTAFLKO5DG4SH_371846, targetSchemaCode:null, tableName:query_APP_I8PRTK1GTAFL_234946_6d60de83d95fb0b96dd2ae1e_069cd3, queryCode:query_APP_I8PRTK1GTAFL_234946_6d60de83d95fb0b96dd2ae1e_069cd3, costTime:73113 error msg:表数据为空异常。详情:Query table:query_APP_I8PRTK1GTAFL_234946_6d60de83d95fb0b96dd2ae1e_069cd3 data size equal zero. cannot be accelerated. , root msg:DataSizeZeroException: 表数据为空异常。详情:Query table:query_APP_I8PRTK1GTAFL_234946_6d60de83d95fb0b96dd2ae1e_069cd3 data size equal zero. cannot be accelerated.
    ```
  </Accordion>

  <Accordion id="q2" title="4.2 Why does configuring a data source return an error?">
    (1) Error 1

    **Cause**: The file is empty.

    **Solution**: Make sure the file is not empty.

    **Note**: If the file does contain content, open the file, save it again, and retry the upload.

    (2) Error 2

    **Cause 1**: Only MySQL 5.7 and earlier versions are currently supported.

    **Cause 2**: The MySQL server has an access allowlist configured, and the IP of the server hosting YiDA is not on the allowlist.

    **Solution**:

    1. Change the MySQL version.

    2. Add the IP of the server hosting YiDA to the MySQL access allowlist.
  </Accordion>

  <Accordion id="q3" title="4.3 Can the default update interval for a MySQL database connected in data preparation be changed?">
    The data acceleration schedule and interval cannot currently be customized.
  </Accordion>
</AccordionGroup>
