$CONDITION during sqoop import

Hi Friends,

Can someone please advise, that what’s the use of $CONDITION in sqoop and what it does basically. And how we decide that we need to use $CONDITION in this particular place.
And , i observed that $CONDiTION was replaced as (0 = 1) and (1 = 1), which executing query. So, not clear about it’s usage.

It is created just for developer convenience. You do not need to worry about it.

1 Like

@yadavpavan, its purely depends on how you are invoking sqoop import.

WHERE $CONDITION should be used when sqoop import has --query parameter whether you are giving an explicit WHERE clause with a condition or not.

If your SELECT DDL has any condition then you need to use WHERE < your condition> AND $CONDITION.
#With WHERE $CONDITIONS
sqoop import
-connect jdbc:mysql://localhost:3306/retail_db
–username root
–password cloudera
–query “select department_id, department_name from departments WHERE
$CONDITIONS”
–target-dir /user/cloudera/cca175/review/sqoop_import/mysql_departments_query
-m 1

#Specific columns but with out using WHERE CONDITIONS
sqoop import
–connect jdbc:mysql://localhost:3306/retail_db
–username root
–password cloudera
–table departments
–columns ‘department_name , department_id’
–target-dir /user/cloudera/cca175/review/sqoop_import/mysql_departments_columns
-m 5