Showing posts with label Sqoop. Show all posts
Showing posts with label Sqoop. Show all posts

Thursday, June 27, 2019

Sqoop - Eval


Eval is normally used to run simple sql queries against the database server.It will also preview the result on the console level.Eval can be used to evaluate any type of query like DDL/DML.

EVAL is only to check the database connection and also to preview the small set of data.It will provide the user to test the simple queries.

Sqoop Syntax :-

sqoop --eval {generic-args} {eval args}

Generic args :-

Argument Description
–connect <jdbc-uri>
Specify JDBC connect string
–connection-manager <class-name>
Specify connection manager class to use
–driver <class-name>
Manually specify JDBC driver class to use
–hadoop-mapred-home <dir>
Override $HADOOP_MAPRED_HOME
–help
Print usage instructions
–password-file
Set path for a file containing the authentication password
-P
Read password from console
–password <password>
Set authentication password
–username <username>
Set authentication username
–verbose
Print more information while working
–connection-param-file <filename>
Optional properties file that provides connection parameters
–relaxed-isolation
Set connection transaction isolation to read uncommitted for the mappers.


Eval Args :-

e ,query Execute statement in SQL.

query examples :-

sqoop eval \
–connect jdbc:mysql://localhost/test \
–username root \
–query “SELECT * FROM sqoop_test ”





Sunday, September 30, 2018

Sqoop -Command(Part 2)

In the Sqoop Command 1 , we have gone through some of the basic commands that are used in Sqoop. In this blog post , we will have other commands and how they are effectively used in Sqoop.

Import all Tables :- This command will import all the tables from the mysql into the HDFS directory.
Syntax :-  sqoop import-all-tables --connect jdbc:mysql://localhost/database --username root -P --warehouse-dir  -tablename














Exclude table while importing :- This command will exclude the tables that are not necessary for importing.
Syntax :-  sqoop import-all-tables --connect jdbc:mysql://localhost/database --exclude-tables tablename  --username student -P --warehouse-dir tablename


This command will import all the tables excluding the one which are mentioned in the --exclude command .

Note :- If we are notusing the primary key then we annot acheive the parallelism and in that case we need to specify the mapper -m 1.

Filter while importing data :-  In Sqoop , we ccan filter out the data while importing the table  into the HDFS directory.
Syntax :- sqoop import --connect jdbc:mysql://localhost/database --username  -P --table tablename --target-dir dirname -m 1 --where "col= 'xx'"

Sqoop Hive Import :- We can directly import data into hive through sqoop .
Syntax :-  sqoop import --connect jdbc:mysql://localhost/database  --table tablename --hive-import --username root -P -m 1

Delta Lake - Time Travel

  Time Travel allows you to query, restore, or compare data from a previous version of a Delta table. Delta Lake automatically keeps tra...