|
| 1 | +# FineBI |
| 2 | + |
| 3 | +{% include [../../postgresql/_includes/alert_preview.md](../../postgresql/_includes/alert_preview.md) %} |
| 4 | + |
| 5 | +FineBI is a powerful big data analytics tool. FineBI allows organizations to analyze and share data for informed decision-making. It helps transform raw data into insightful visualizations, track KPIs, identify trends, and predict future outcomes. |
| 6 | + |
| 7 | +[PostgreSQL compatibility mode in {{ ydb-short-name }}](../../postgresql/intro.md) enables the use of [FineBI](https://intl.finebi.com/) to query and visualize data from {{ ydb-short-name }}. In this case FineBI works with {{ ydb-short-name }} just like with PostgreSQL. |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +Before you begin, make sure that the following software is installed: |
| 12 | + |
| 13 | +* [FineBI](https://intl.finebi.com/). |
| 14 | +* PostgreSQL JDBC driver uploaded to FineBI. |
| 15 | + |
| 16 | + {% note info %} |
| 17 | + |
| 18 | + You can download the latest PostgreSQL JDBC driver from the [Download page](https://jdbc.postgresql.org/download/) of the PostgreSQL web site. For information on how to upload the PostgreSQL JDBC driver to FineBI, refer to the [FineBI documentation](https://help.fanruan.com/finebi-en/doc-view-1540.html). |
| 19 | + |
| 20 | + {% endnote %} |
| 21 | + |
| 22 | + |
| 23 | +## Adding a database connection to {{ ydb-short-name }} {#add-database-connection} |
| 24 | + |
| 25 | +To connect to {{ ydb-short-name }} from FineBI using the PostgreSQL wire protocol, follow these steps: |
| 26 | + |
| 27 | +1. Log in to FineBI as the `admin` user. |
| 28 | + |
| 29 | +1. Navigate to **System Management** > **Data Connection** > **Data Connection Management**. |
| 30 | + |
| 31 | +1. Click the **New Data Connection** button. |
| 32 | + |
| 33 | +1. In the **Search** field, type `postgresql` to find the PostgreSQL icon. |
| 34 | + |
| 35 | +1. Click the PostgreSQL icon. |
| 36 | + |
| 37 | +1. Enter the {{ ydb-short-name }} credentials in the corresponding fields: |
| 38 | + |
| 39 | + * **Data Connection Name**. The {{ ydb-short-name }} connection name in FineBI. |
| 40 | + |
| 41 | + * **Driver**. The driver that FineBI uses to connect to {{ ydb-short-name }}. |
| 42 | + |
| 43 | + Select `Custom` and the installed JDBC driver `org.postgresql.Driver`. |
| 44 | + |
| 45 | + * **Database Name**. The path to the [database](../../concepts/glossary.md#database) in the {{ ydb-short-name }} cluster where queries will be executed. |
| 46 | + |
| 47 | + {% note alert %} |
| 48 | + |
| 49 | + Special characters in the path string must be [URL encoded](https://en.wikipedia.org/wiki/Percent-encoding). For example, ensure that you replace slash (`/`) characters with `%2F`. |
| 50 | + |
| 51 | + {% endnote %} |
| 52 | + |
| 53 | + * **Host**. The [endpoint](https://ydb.tech/docs/en/concepts/connect#endpoint) of the {{ ydb-short-name }} cluster to which the connection will be made. |
| 54 | + |
| 55 | + * **Port**. The port of the {{ ydb-short-name }} endpoint. |
| 56 | + |
| 57 | + * **Username**. The login for connecting to the {{ ydb-short-name }} database. |
| 58 | + |
| 59 | + * **Password**. The password for connecting to the {{ ydb-short-name }} database. |
| 60 | + |
| 61 | +  |
| 62 | + |
| 63 | +1. Click **Test Connection**. |
| 64 | + |
| 65 | + If the connection details are correct, a message confirming a successful connection will appear. |
| 66 | + |
| 67 | +1. To save the database connection, click **Save**. |
| 68 | + |
| 69 | + A new database connection will appear in the **Data Connection** list. |
| 70 | + |
| 71 | +## Adding an SQL Dataset {#add-dataset} |
| 72 | + |
| 73 | +To create a dataset for a {{ ydb-short-name }} table, follow these steps: |
| 74 | + |
| 75 | +1. In FineBI, open the **Public Data** tab. |
| 76 | + |
| 77 | +1. Select a folder, to which you want to add a dataset. |
| 78 | + |
| 79 | + {% note warning %} |
| 80 | + |
| 81 | + You must have the [Public Data Management](https://help.fanruan.com/finebi-en/doc-view-5734.html) permission for the selected folder in FineBI. |
| 82 | + |
| 83 | + {% endnote %} |
| 84 | + |
| 85 | +1. Click **Add Dataset** and select **SQL Dataset** from the drop-down list. |
| 86 | + |
| 87 | +1. In the **Table Name** field, enter a name for the dataset. |
| 88 | + |
| 89 | +1. In the **Data from Data Connection** drop-down list, select the {{ ydb-short-name }} connection you created. |
| 90 | + |
| 91 | +1. In the **SQL Statement** field, enter the SQL query to retrieve the necessary columns from a {{ ydb-short-name }} table. For example, `SELECT * FROM <ydb_table_name>` for all columns. |
| 92 | + |
| 93 | + {% note tip %} |
| 94 | + |
| 95 | + To create a dataset for a table located in a subdirectory of a {{ ydb-short-name }} database, specify the table path in the table name. For example: |
| 96 | + |
| 97 | + ```sql |
| 98 | + SELECT * FROM "<path/to/subdirectory/table_name>"; |
| 99 | + ``` |
| 100 | + |
| 101 | + {% endnote %} |
| 102 | + |
| 103 | +1. To test the SQL query, click **Preview**. If the query is correct, the table data will appear in the preview pane. |
| 104 | + |
| 105 | +  |
| 106 | + |
| 107 | +1. To save the dataset, click **OK**. |
| 108 | + |
| 109 | +After creating datasets, you can use data from {{ ydb-short-name }} to create charts in FineBI. For more information, refer to the [FineBI](https://help.fanruan.com/finebi-en/) documentation. |
| 110 | + |
| 111 | +## Creating a chart {#create-chart} |
| 112 | + |
| 113 | +Let's create a sample chart using the dataset from the `episodes` table, as described in the [YQL tutorial](../../dev/yql-tutorial/index.md). Among other things, this tutorial covers how to [create](../../dev/yql-tutorial/create_demo_tables.md) this table and [populate it with data](../../dev/yql-tutorial/fill_tables_with_data.md). It will be a pie chart that demonstrates how many episodes each season of a given series contains. |
| 114 | +
|
| 115 | +The table contains the following columns: |
| 116 | +* `series_id` |
| 117 | +* `season_id` |
| 118 | +* `episode_id` |
| 119 | +* `title` |
| 120 | +* `air_date` |
| 121 | +
|
| 122 | +To create a chart, follow these steps: |
| 123 | +
|
| 124 | +1. In FineBI, open the **My Analysis** tab. |
| 125 | +
|
| 126 | +1. Click **New Subject**. |
| 127 | +
|
| 128 | + The **Select Data** dialog box will appear. |
| 129 | +
|
| 130 | +1. In the **Select Data** dialog box, navigate to the dataset for the `episodes` table and click **OK**. |
| 131 | +
|
| 132 | +1. Click the **Component** tab at the bottom of the page. |
| 133 | +
|
| 134 | +1. In the **Chart Type** pane, click the **Pie Chart** icon. |
| 135 | +
|
| 136 | +1. In the list of columns in the `episodes` dataset, click the arrow next to the `episode_id` column and select **Convert to Dimension** from the drop-down list. |
| 137 | +
|
| 138 | +  |
| 139 | +
|
| 140 | +1. Drag the `season_id` column to the **Color** field. |
| 141 | +
|
| 142 | +1. Drag the `title` column to the **Label** field. |
| 143 | +
|
| 144 | +1. Drag the `series_id` column to the **Filter** field. |
| 145 | +
|
| 146 | + The **Add Filter to episodes.series_id** dialog box will appear. |
| 147 | +
|
| 148 | +1. In the **Add Filter to episodes.series_id** dialog box, select `Detailed Value` and click **Next Step**. |
| 149 | +
|
| 150 | +1. Specify the following condition: |
| 151 | +
|
| 152 | + `series_id` `Equal To` `Fixed Value` `2` |
| 153 | +
|
| 154 | +1. Click **OK**. |
| 155 | +
|
| 156 | + The diagram will display data only for the series that has the ID of `2`. |
| 157 | +
|
| 158 | +  |
| 159 | +
|
| 160 | +1. Click **Save**. |
0 commit comments