...

Cloud Computing - Sqoop

Back to Course

Lesson Description


Lession - #799 Sqoop Eval


This section depicts how to utilize the Sqoop 'eval' apparatus. It permits clients to execute client characterized questions against individual data set servers and see the outcome in the control center. In this way, the client can anticipate that the resultant table information should import. Utilizing eval, we can assess any kind of SQL inquiry that can be either DDL or DML explanation.

Syntax

Below is the syntax for sqoop eval command.
$ sqoop eval (generic-args>
(eval-args>
$ sqoop-eval (generic-args>
(eval-args>

Select Query Evaluation

Utilizing eval apparatus, we can assess any kind of SQL query. Allow us to take an instance of choosing restricted lines in the Employees table of db data set. The accompanying order is utilized to assess the given model utilizing SQL query.
$ sqoop eval \
--connect jdbc:mysql://localhost/db \
--username root \ 
--query “SELECT * FROM employees LIMIT 3”
In the event that the command executes effectively, it will deliver the accompanying result on the terminal.
+------+--------------+-------------+-------------------+--------+
| Id   | Emp_Name     | Designation | Salary            | Dept   |
+------+--------------+-------------+-------------------+--------+
| 101 |  Jyoti     | manager     | 60000             | AC     |
| 102 | laxmi      | python dev  | 60000             | TP     |
| 103 | roopa      | .NET dev    | 40000             | TP     |
+------+--------------+-------------+-------------------+--------+

Insert Query Evaluation

Sqoop eval tool can be appropriate for both displaying and characterizing the SQL explanations. That implies, we can utilize eval for embed articulations as well. The accompanying order is utilized to embed another line in the employees table of db database.
$ sqoop eval \
--connect jdbc:mysql://localhost/db \
--username root \ 
-e “INSERT INTO employees VALUES(106,‘Ravi’,‘UI dev’,20000,‘TP’>
On the off chance that the command executes effectively, it will show the situation with the refreshed columns on the control center.

Or disaster will be imminent, you can check the employees table on MySQL console. The accompanying order is utilized to confirm the columns of employees table of db data set utilizing select' query.

mysql>
mysql> use db;
mysql> SELECT * FROM employees;
+------+--------------+-------------+-------------------+--------+
| Id   | Emp_Name     |Designation  |    Salary        | Dept   |
+------+--------------+-------------+-------------------+--------+
| 101 | Jyoti        | manager     | 60000             | AC     |
| 102 | laxmi        | python dev  | 60000             | TP     |
| 103 | roopa        | .NET dev    | 40000             | TP     |
| 104 | deepa        | .NET dev    | 30000             | AC     |
| 105 | komal        | admin       | 10000             | TP     | 
|106  | ravi         | UI dev      | 20000             | TP     |
+------+--------------+-------------+-------------------+--------+