Use HUE to execute multiple SQL

HUE is a hadoop ui tool contributed by Cloudera to the apache community. It can manage Hadoop and connect to query systems such as Hive, Impala, etc. It is very convenient to use. However, when we submit SQL using HUE, only the last SQL will be executed by default. Therefore, when we execute the following SQL, an error will be reported:

It will prompt that the table does not exist (the error in the figure is the log thrown by the Impala query system), because HUE will only execute the last SQL by default. So, what if we want to execute multiple SQLs? It's very simple. Just select all the SQL in the dialog box and click Run to execute all the SQLs in sequence, as shown below:

We can see that all 3 SQLs have been successfully executed. Above the "Run" button, we can see that 3/3 is displayed, indicating the execution progress. However, if the semicolon is not displayed at the end of the SQL, even if you execute it after selecting all, HUE will execute the three SQLs as one SQL instead of splitting them by line breaks, as shown below:

We can see from the figure that the final SQL submitted is: create table student(id int, name string) insert into student values(1001,'Xiaoming') select * from student, so when we want to execute multiple SQLs in batches At that time, be sure to add a semicolon at the end of each SQL.

It is worth noting that these batches of SQL executed are all completed in the same session. In other words, if the session level parameter is set in the first SQL, it will affect the SQL executed later. For example, in impala, we can use this method to set the SQL submission queue:

Here, HUE does not automatically execute all SQL sequentially, but stops after the first execution is completed. At this time, we need to click the run button again to continue execution. It can be seen by referring to 1/2 and 2/2 in the above two figures. But the setting has indeed taken effect, that is to say, the SQL of select 1 is completed on the impala queue. This needs to be checked on the Impala management page, so I won’t repeat it here.

Intelligent Recommendation

MyBatis dynamic SQL execute multiple SQL

MyBatis how to execute multiple statements (use mysql database) once. 1, modify the connection parameters plus allowMultiQueries = true, such as: 2, the direct write multiple statements, use ";&q...

Hue use

1. HUE operation HDFS Enter the HDFS management interface HDFS new folder create a new file upload files View hdfs file content Edit HDFS file Delete Files Change the file permissions 2. HUE operation...

How to execute Java programs on HUE

HUE version: 3.12.0 Preface Access via browserip:8888Log in to the HUE interface, you will be prompted to create a user for the first login, here use the account/password:hue/hueLog in. 1. Business sc...

Create Workflows in HUE and execute hql

Create Workflows in HUE and execute hql 1. Prepare hql first Create a path to store hql Click on File browser Click new on the right to create the path: /user/hive/work/hiveSQLRun/Student.hql 2. Creat...

To use MyBatis to execute multiple SQL statements at once, you need to configure the jdbc connection string

There is a common scenario: when deleting a user, you need to delete the user's foreign key related data first, otherwise the rule will be triggered and an error will be reported. There are three solu...

More Recommendation

Mybatis a select tag to execute multiple sql statements

The first step: first configure the connection pool configuration as: The second step: The Dao layer interface is:  ...

SpringBoot uses Mybatis to execute multiple SQL

Implementing Mybatis in SpringBoot to execute multiple SQLs, Google first waved, and found that only need to add this after the url connected to Mysql: allowMultiQueries=true The added url is like thi...

Transactional applications - execute multiple SQL statements

  The transaction has atomicity, either not executed or full execution, once the successful implementation of permanent preservation.It is because of these atoms and the formation of persistent d...

Mybatis execute multiple SQL (Mysql, Oracle)

Mybatis execute multiple SQL (Mysql, Oracle) Mysql: data connectivity through multiple processing statements is added later allowMultiQueries = true url Example: Oracle:...

plsql execute multiple sql script (batch execution)

1, in the usual us on line, on the line if spl more, we executed one by one, then efficiency is relatively low, but also prone to error. I have the following method to demonstrate at the outset I use....

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top