Sqoop Interview Questions and Answers For Freshers Part-3
21.How do you clear the data in a staging table before loading it by Sqoop?
By specifying the –clear-staging-table option we can clear the staging table before it is loaded. This can be done again and again till we get proper data in staging.
22.How will you update the rows that are already exported?
The parameter –update-key can be used to update existing rows. In it a comma-separated list of columns is used which uniquely identifies a row. All of these columns is used in the WHERE clause of the generated UPDATE query. All other table columns will be used in the SET part of the query.
23.How can you sync a exported table with HDFS data in which some rows are deleted?
Truncate the target table and load it again.
24.How can you export only a subset of columns to a relational table using sqoop?
By using the –column parameter in which we mention the required column names as a comma separated list of values.
25.How can we load to a column in a relational table which is not null but the incoming value from HDFS has a null value?
By using the –input-null-string parameter we can specify a default value and that will allow the row to be inserted into the target table.
26.How can you schedule a sqoop job using Oozie?
Oozie has in-built sqoop actions inside which we can mention the sqoop commands to be executed.
27.Sqoop imported a table successfully to HBase but it is found that the number of rows is fewer than expected. What can be the cause?
Some of the imported records might have null values in all the columns. As Hbase does not allow all null values in a row, those rows get dropped.
28.Give a sqoop command to show all the databases in a MySql server.
$ sqoop list-databases –connect jdbc:mysql://database.example.com/
29.What do you mean by Free Form Import in Sqoop?
Sqoop can import data form a relational database using any SQL query rather than only using table and column name parameters.
30.How can you force sqoop to execute a free form Sql query only once and import the rows serially.
By using the –m 1 clause in the import command, sqoop cerates only one mapreduce task which will import the rows sequentially.