Cheap VPS & Xen Server


Residential Proxy Network - Hourly & Monthly Packages

Sqoop Where


You can place restrictions on data imported by using “where” clause. Let’s import cityByCountry table where state ( 6th column is restricted to “Alaska”).

mySql_WhereClause

The Sqoop statement is written below

  1. sqoop import \ –connect “jdbc:mysql://localhost/training” \ –username training -P \ –table cityByCountry \ –target-dir /user/where_clause \ –where “state = ‘Alaska’” \ -m 1

Output is shown below

Where_output

Where_output

Let’s list all databases present on a mysql server using a “list-databases” tool.

Note : for more information on list-databases, type “$ sqoop help list-databases”.

  1. $ sqoop list-databases –connect “jdbc:mysql://localhost” –username cloudera –password cloudera

Similarly for listing tables

  1. $ sqoop list-tables –connect “jdbc:mysql://localhost/training” –username cloudera -P

Comments

comments