Last active
December 28, 2022 19:50
-
-
Save rch/faa32c77017794e634d0b4aad157eb4c to your computer and use it in GitHub Desktop.
Sqoop Utils
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
export DB_TYPE= | |
export DB_HOST= | |
export DB_PORT= | |
export DB_NAME= | |
# e.g. jdbc:mysql://database.example.com/ | |
export DB_URI=jdbc:$DB_TYPE:thin:@$DB_HOST:$DB_PORT:$DB_NAME | |
export DB_USER= | |
export DB_PASS= | |
export DB_DRIVER= | |
export DB_SOURCE_TABLE= | |
# e.g. hdfs://localhost:9000/user/username/scoop_import/avro_snaapy | |
export TARGET_DIR= | |
sqoop import \ | |
--connect $DB_URI \ | |
--username $DB_USER \ | |
--password $DB_PASS \ | |
--driver $DB_DRIVER \ | |
--table $DB_SOURCE_TABLE \ | |
--target-dir $DB_TARGET_DIR \ | |
--as-avrodatafile \ | |
--append \ | |
--compression-codec snappy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
sqoop import -Dmapreduce.job.user.classpath.first=true \ | |
--connect $DB_URI \ | |
--username $DB_USER \ | |
--password $DB_PASS \ | |
--as-parquetfile \ | |
-m 2 \ | |
--outdir /tmp/data \ | |
--target-dir /path/to/table \ | |
--table $DB_TABLE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
export DB_TYPE=oracle | |
export DB_HOST= | |
export DB_PORT= | |
export DB_NAME= | |
export DB_SID= | |
export SQOOP_HOME=/var/lib/sqoop | |
# e.g. jdbc:mysql://database.example.com/ | |
export DB_URI=jdbc:$DB_TYPE:thin:@$DB_HOST:$DB_PORT:$DB_SID | |
sqoop eval --connect $DB_URI --username $DB_USER --password $DB_PASS --query "SELECT * FROM DUAL" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment