Sqoop eval

Let’s study about the Sqoop eval

In this article will study about how to use ‘eval’ tool to run simple SQL queries.

Features of eval tool

* The “eval” tool is used for evaluation purpose like run simple SQL queries quickly against a database.

* The results are printed in the console itself.

* eval tool used to test simple queries and verify database connection from the Sqoop.

* It is not used in used in production workflows.

There are different cases of using “eval” tool they are,

1. Select Query Evaluation

In this case using “eval” tool we can evaluate simple SQL query using select.

Example

Let us take an example of selecting rows of the table “emp” from beyondcorner database in mysql.

Below command display the content of table “emp”

$ sqoop eval

–connect jdbc:mysql://localhost/beyondcorner

–username “root”

–password “beyonduser”

–query “select * from emp”

2. Insert Query Evaluation

In this case using “eval” tool we can insert new row into a table “emp”

Example

Below command display how to insert new row into the table “emp”

$ sqoop eval

–connect jdbc:mysql://localhost/beyondcorner

–username “root”

–password “beyonduser”

–query “insert into emp values(77,’raju’,79)”

 Reference

https://sqoop.apache.org/docs/1.4.6/SqoopUserGuide.html#_literal_sqoop_eval_literal