Skip to content

Instantly share code, notes, and snippets.

@prasku5
Created May 3, 2018 16:50
Show Gist options
  • Save prasku5/a342523f128e5bed20d5fbbff3bfddc0 to your computer and use it in GitHub Desktop.
Save prasku5/a342523f128e5bed20d5fbbff3bfddc0 to your computer and use it in GitHub Desktop.
sqoop import \
--connect jdbc:mysql://localhost/source_database_name \ (This is the path to access the Source DB using JDBC Driver)
--username <username> \ (Source Database Username)
--password <password> \ (Source Database password)
--database source_database_name \ (The database name will become folder name in target HDFS )
--table Source_table_name \ (This will store the files in .gz compression which is default)
-m 4
--fields-terminated-by '\t' (we explicitly mention that data imported into HDFS will have the fields terminated with '\t' character)
--lines terminated-by '\n' (we explicitly mention that data imported into HDFS will have records terminated with '\n' character)
--null-string "Not Available" (If the Input data contains Null string type fields it will be replaced with the given string)
--null-non-string -1 (If the Input data contains Null numeric type fields it will be replaced with given value )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment