Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Sqoop, mail # user - Re: Both table name and SQL cannot be specified


Copy link to this message
-
Re: Both table name and SQL cannot be specified
Suhas Satish 2014-04-02, 19:54
Hi there,
I am having trouble with sqoop2 cli in getting a successful job completion.
After following this thread, this is where I am now stuck. Why is sqoop
wrapping around my simple sql construct with *SQOOP_SUBQUERY_ALIAS.name* ?
How do I get rid of it?

I tried looking for a working example, but wasn't able to find one.
*New connection was successfully created with validation status FINE and
persistent id 2*
create job --xid 1 --type import
*New job was successfully created with validation status FINE  and
persistent id 6*

start job --jid 6
Exception has occurred during processing command
Exception: org.apache.sqoop.common.SqoopException Message:
CLIENT_0001:Server has returned exception

2014-04-02 12:44:20,044 DEBUG jdbc.GenericJdbcImportInitializer
[org.apache.sqoop.connector.jdbc.GenericJdbcImportInitializer.configurePartitionProperties(GenericJdbcImportInitializer.java:206)]
*Using minMaxQuery: SELECT MIN(SQOOP_SUBQUERY_ALIAS.name),
MAX(SQOOP_SUBQUERY_ALIAS.name) FROM (select count(name) from voter where 1
= 1) *SQOOP_SUBQUERY_ALIAS
2014-04-02 12:44:20,046 ERROR server.SqoopProtocolServlet
[org.apache.sqoop.server.SqoopProtocolServlet.doPost(SqoopProtocolServlet.java:68)]
Exception in POST http://localhost:8080/sqoop/v1/submission/action/6

*Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
Unknown column 'SQOOP_SUBQUERY_ALIAS.name' in 'field list'*

This is my job creation configuration in sqoop CLI -
Schema name:
Table name:
Table SQL statement: select count(name) from voter where ${CONDITIONS}
Table column names: name
Partition column name: name
Nulls in partition column: yes
Boundary query:
Output directory: /user/root/sqoop2

Here's my mysql database table schema-

 show columns from voter;
+---------------+-------------+------+-----+---------+-------+
| Field         | Type        | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+-------+
| rownum        | int(11)     | YES  |     | NULL    |       |
| name          | varchar(50) | YES  |     | NULL    |       |
| age           | tinyint(4)  | YES  |     | NULL    |       |
| registration  | varchar(15) | YES  |     | NULL    |       |
| contributions | float       | YES  |     | NULL    |       |
| voterzone     | smallint(6) | YES  |     | NULL    |       |
+---------------+-------------+------+-----+---------+-------+
Thanks,
Suhas.
On Mon, Dec 30, 2013 at 6:30 PM, centerqi hu <[EMAIL PROTECTED]> wrote: