Connect GBI to the Hologres real-time data warehouse

Updated at:

Connecting GBI to the Hologres real-time data warehouse allows Hologres to query and send data to GBI for real-time data analysis. This topic describes how to connect GBI to the Hologres real-time data warehouse and use natural language Q&A for data analysis.

Prerequisites

Before you begin, you can learn about what the Hologres real-time data warehouse is.

Procedure

Prepare data in Hologres

The following example uses the ORDERS table from the TPC-H public dataset provided by MaxCompute. No additional preparation is needed. Run the following SQL statements to import data from the ORDERS table into Hologres using a MaxCompute foreign table.

-- Create a foreign table
IMPORT FOREIGN SCHEMA public_data
LIMIT TO (ORDERS_10g)
FROM SERVER odps_server INTO public options (if_table_exist 'update');

-- Create an internal table
BEGIN;
CREATE TABLE ORDERS (
    O_ORDERKEY bigint NOT NULL PRIMARY KEY,
    O_CUSTKEY int NOT NULL,
    O_ORDERSTATUS text NOT NULL,
    O_TOTALPRICE DECIMAL(12, 2) NOT NULL,
    O_ORDERDATE timestamptz NOT NULL,
    O_ORDERPRIORITY text NOT NULL,
    O_CLERK text NOT NULL,
    O_SHIPPRIORITY int NOT NULL,
    O_COMMENT text NOT NULL
);

CALL set_table_property ('ORDERS', 'segment_key', 'O_ORDERDATE');
CALL set_table_property ('ORDERS', 'distribution_key', 'O_ORDERKEY');
CALL set_table_property ('ORDERS', 'bitmap_columns', 'O_ORDERKEY,O_CUSTKEY,O_ORDERSTATUS,O_ORDERPRIORITY,O_CLERK,O_SHIPPRIORITY,O_COMMENT');
CALL set_table_property ('ORDERS', 'dictionary_encoding_columns', 'O_ORDERSTATUS,O_ORDERPRIORITY,O_CLERK,O_COMMENT');

COMMENT ON COLUMN ORDERS.O_ORDERKEY IS 'Order ID';
COMMENT ON COLUMN ORDERS.O_CUSTKEY IS 'Customer ID';
COMMENT ON COLUMN ORDERS.O_ORDERSTATUS IS 'Order Status';
COMMENT ON COLUMN ORDERS.O_TOTALPRICE IS 'Total Price';
COMMENT ON COLUMN ORDERS.O_ORDERDATE IS 'Order Date';
COMMENT ON COLUMN ORDERS.O_ORDERPRIORITY IS 'Order Priority';
COMMENT ON COLUMN ORDERS.O_CLERK IS 'Clerk';
COMMENT ON COLUMN ORDERS.O_SHIPPRIORITY IS 'Shipping Priority';
COMMENT ON COLUMN ORDERS.O_COMMENT IS 'Comment';

COMMIT;

-- Import data into the internal table
INSERT INTO ORDERS SELECT * FROM ORDERS_10g;

Connect to Hologres

GBI supports connections to Hologres over the public network. For more information, see Instance Details. Perform the following steps:

  1. Go to the App Square solutions page. Under GBI, click View.

  2. Click Data Table Management. Under Access public database, select PostgreSQL, and then click Authorize Connection.

    To connect to Hologres over the public network, manually enable the public network in the Network Information section on the Instance Details page of the Hologres management console.

  3. Enter the database configuration parameters and login information, and then click Authorize Connection.

    The following table describes the parameters.

    Parameter

    Description

    IP address/domain name

    The domain name of your Hologres instance. To find it, go to the Hologres management console, click your instance in the Instance List, and navigate to the Instance Details page. The domain name is listed in the Public Network section under Network Information.

    Port

    The network port of the Hologres instance. To find it, go to the Hologres management console, click your instance in the Instance List, and navigate to the Instance Details page. The port is listed in the Public Network section under Network Information.

    Database name

    The name of the database to connect to. To find the database name, go to the Hologres management console, click Go to HoloWeb, connect and log in to your instance, and check the database name under Logged-in Instances.

    Database schema

    The database schema to connect to. The default is public. You can also specify other schemas.

    Database username

    The AccessKey ID of your account. For information about how to obtain it, see AccessKey Management.

    Database password

    The AccessKey Secret of your account. For information about how to obtain it, see Create an access key.

  4. On the right, click Associate Data Table. Select the data table to associate, and then click Confirm Association.

    Once associated, you can manage the data table.

Natural language Q&A

On the Generative BI Homepage, use Natural Language Q&A to analyze data. In the input box, ask a question about your data, such as "How many orders are there per year? How many are top-priority orders?".

The system automatically rewrites the question, selects the appropriate data table, generates and executes a SQL query, and displays the results in a table. You can also click Edit SQL to modify the generated SQL statement.

More features and operations

For advanced operations such as managing enterprise data, managing model optimization cases, and intervening in model output, see the Generative BI User Guide.