Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to execute multiple SQL queries with Sqoop import --query command? Also what is the maximum size of query string?

Solved Go to solution
Highlighted

How to execute multiple SQL queries with Sqoop import --query command? Also what is the maximum size of query string?

How to execute multiple SQL queries with Sqoop import --query command? Also what is the maximum size of query string?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to execute multiple SQL queries with Sqoop import --query command? Also what is the maximum size of query string?

Expert Contributor

@Mahendra Dahiya

The sqoop import --query option is intended to process a single statement and there are warnings about using complex queries.

The facility of using free-form query in the current version of Sqoop
is limited to simple queries where there are no ambiguous projections and
no OR conditions in the WHERE clause. Use of complex queries such as
queries that have sub-queries or joins leading to ambiguous projections can
lead to unexpected results.

A few more details are at this URL:

https://sqoop.apache.org/docs/1.4.2/SqoopUserGuide.html#_free_form_query_imports

View solution in original post

4 REPLIES 4
Highlighted

Re: How to execute multiple SQL queries with Sqoop import --query command? Also what is the maximum size of query string?

Expert Contributor

@Mahendra Dahiya

The sqoop import --query option is intended to process a single statement and there are warnings about using complex queries.

The facility of using free-form query in the current version of Sqoop
is limited to simple queries where there are no ambiguous projections and
no OR conditions in the WHERE clause. Use of complex queries such as
queries that have sub-queries or joins leading to ambiguous projections can
lead to unexpected results.

A few more details are at this URL:

https://sqoop.apache.org/docs/1.4.2/SqoopUserGuide.html#_free_form_query_imports

View solution in original post

Highlighted

Re: How to execute multiple SQL queries with Sqoop import --query command? Also what is the maximum size of query string?

Thanks Terry. What is the alternate solution to execute multiple sql query ?

Highlighted

Re: How to execute multiple SQL queries with Sqoop import --query command? Also what is the maximum size of query string?

Expert Contributor

You are welcome Mahendra. I think you will have to push the complex query to the database and place those results into a different table and then perform the sqoop command on that table. Best of luck.

Highlighted

Re: How to execute multiple SQL queries with Sqoop import --query command? Also what is the maximum size of query string?

Rising Star

How about create views in source databases.

Don't have an account?
Coming from Hortonworks? Activate your account here