- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Is there a way to execute free form query from a file in sqoop?
- Labels:
-
Apache Hadoop
-
Apache Sqoop
Created ‎07-17-2018 02:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have executed a similar kind of sqoop command as shown below. The free form query mentioned below, I wanted to keep it in a file and run the sqoop command since my real time queries are quite complex and bigger.
Wanted to know, Is there a way to keep the query in a file and execute the sqoop command which will refer the free form query inside the file and execute? like we do for --password-file case. Thanks in advance.
<code>sqoop import --connect "jdbc:mysql://<localhost>:port" --username "admin" --password-file "<passwordfile>" --query "select * from employee" --split-by employee_id --target-dir "<target directory>" --incremental append --check-column employee_id --last-value 0 --fields-terminated-by "|"
Created ‎07-18-2018 05:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @Nandan B R!
Maybe the sqoop options work in this case, but, I didn't test it.
https://sqoop.apache.org/docs/1.4.2/SqoopUserGuide.html#_using_options_files_to_pass_arguments
Another way would be to use shell variables and create a script which replaces the --query value by $variable. Or you can try the sqoop 2 using the JDBC Conn
https://sqoop.apache.org/docs/1.99.7/user/connectors/Connector-GenericJDBC.html
Hope this helps!
