sqoop-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 王峰 <wangfengfight...@gmail.com>
Subject How to specify the column names when export HDFS data into MySQL tables?
Date Mon, 25 Dec 2017 09:35:27 GMT

      I have a question on the export of sqoop(V1.4.6) need your help,
the problem is as follows:

When I export HDFS file into MySQL table `test`  the `TABLE_SCHEMA` of
`test` are as follows:


and got error like this:

ERROR [Thread-11] org.apache.sqoop.mapreduce.AsyncSqlOutputFormat: Got
exception in update thread:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an
error in your SQL syntax; check the manual that corresponds to your
MariaDB server version for the right syntax to use near 'int, double,
string) VALUES ('bankcard', 'sex', 'HTTPStateCode', 'boolean', 'dom'
at line 1
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
	at com.mysql.jdbc.Util.getInstance(Util.java:383)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1062)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2840)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2082)
	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1302)
	at org.apache.sqoop.mapreduce.AsyncSqlOutputFormat$AsyncSqlExecThread.run(AsyncSqlOutputFormat.java:233)

1. I know the reason why the job going to false,And I want to ask if
there is any way to specify the table columns like translate* int to
`int` & double to `double`* in my case?

2. I want to edit the source code adding the escape char to column
names,however, I could not find where the getColumnNamesForRawQuery
is. I try to edit
*org.apache.sqoop.manager.SqlManager.**getColumnNamesForRawQuery* as

        code at 152:      columns.add(colName);   -->

But it did not work for me...

Hope your helps  Thanks....

View raw message