This topic describes how to create, edit, delete, copy, and rename an SQL query task
in the HoloWeb console. You can create SQL query tasks for interactive short-time
queries. However, SQL query tasks do not apply to scenarios in which a large amount
of data is processed offline, such as data import and data export. SQL query tasks
also do not apply to SQL queries that are performed for more than 60 minutes.
Prerequisites
You have logged on to a Hologres instance. For more information, see Log on to an instance.
Create an SQL query task
- Log on to the Hologres console.
- In the top navigation bar, select a region from the drop-down list.

- On the Hologres Instances page, click Go to HoloWeb to go to the HoloWeb console.
- In the HoloWeb console, click in the top navigation bar. In the left-side navigation pane, click the New SQL Query icon.
You can also right-click My SQL query in the left-side navigation pane and select New SQL Query.
In the
New SQL Query dialog box, set the parameters as required. The system automatically specifies the
instance name and database name.

The following table describes the parameters.
Parameter |
Description |
Job Name |
The name of the SQL query task to be created. |
Directory |
The directory in which the SQL query task is to reside. The default directory is /My SQL query. You can also specify a folder that you create.
|
Instance Name |
The name of the Hologres instance in which the SQL query task is to run. You can select
an existing instance from the drop-down list.
Note Both connected and disconnected instances are displayed in the drop-down list. To
view an SQL query task created for a disconnected instance, you must connect to the
instance after you execute SQL statements and save the query results.
|
Database Name |
The name of the database in the Hologres instance in which the SQL query task is to
run.
|
- The new SQL query task is displayed under My SQL query in the left-side navigation pane. You can click a table in the Table Directory section to view the names and data types of the fields in the table. You can also
use standard PostgreSQL statements to analyze data in the SQL editor.
Note The names of tables and fields in SQL statements are not case-sensitive. To search
for a table with an exactly matched name, you must enclose the name of the table in
double quotation marks (") in SQL statements.

- Click Run to execute the SQL statements that you enter.
Note HoloWeb allows SQL statements to be executed for up to 60 minutes. If you execute
SQL statements for more than 60 minutes, the "cancel query due to timeout, queryTimeout
setting is: 3600s" message appears to remind you that time is up.
- Click Save to save the SQL statements in the SQL editor.
View a table
After you create and edit an SQL query task, you can view a table in the Table Directory
section to have a better understanding of its schema.
- In the HoloWeb console, click in the top navigation bar. In the left-side navigation pane, click the New SQL Query icon.
You can also click
My SQL query in the left-side navigation pane and double-click an SQL query task.

- You can view all internal tables in the Table Directory section. Click a table to view the names and data types of the fields in the table.
You can also use standard PostgreSQL statements to analyze data in the SQL editor.
For example, after you execute the CREATE TABLE statement in the SQL editor and click
the

icon, you can view the new table in the Table Directory section. You can click the
table to view its schema.
Note The names of tables and fields in SQL statements are not case-sensitive. To reference
a table with an exactly matched name, you must enclose the name of the table in double
quotation marks (") in SQL statements.
Edit an SQL query task
- In the left-side navigation pane, click My SQL query. Then, find the SQL query task that you want to manage.
If the SQL query task is in a folder, enter the name of the SQL query task in the
search box below
Query.

- Double-click the SQL query task. Then, edit the SQL query task.
- You can enter the SQL statements that you want to execute in the SQL editor and click
Run.
For example, you can execute the following SQL statement:
CREATE TABLE test (
"id" bigint NOT NULL,
"name" text NOT NULL,
"age" bigint,
"class" text NOT NULL,
PRIMARY KEY (id)
);
You can view the execution result of the sample statement by checking the table schema
in the
Table Directory section.
- Click Save. After you click Save, the entered SQL statement is saved for the SQL query task.
Delete an SQL query task
- In the left-side navigation pane, click My SQL query. Then, find the SQL query task that you want to manage.
If the SQL query task is in a folder, enter the name of the SQL query task in the
search box below
Query.

- Right-click the SQL query task and select Delete SQL Query.
- In the message that appears, click OK.
Copy an SQL query task
- In the left-side navigation pane, click My SQL query. Then, find the SQL query task that you want to manage.
If the SQL query task is in a folder, enter the name of the SQL query task in the
search box below
Query.

- Right-click the SQL query task and select Copy SQL Query.
After you perform this operation, the SQL statements in the selected SQL query task
are copied to the clipboard.
- Then, paste the copied statements to the SQL editor of the destination SQL query task.
Rename an SQL query task
- In the left-side navigation pane, click My SQL query. Then, find the SQL query task that you want to manage.
If the SQL query task is in a folder, enter the name of the SQL query task in the
search box below
Query.

- Right-click the SQL query task and select Rename.
- In the Rename SQL file dialog box, enter an updated name in the Rename name field as required.
- Click OK.