Sqoop 无法列出查询中的列
Sqoop Failed to list columns from query
我从 sqoop 针对 mysql 数据库 (4.1.22-standard-log)
执行了这个简单的命令
sqoop import --connect jdbc:mysql://test.ddc:3306/test --table "foo" --username test --password bar --hive -table test.foo --as-avrodatafile --target-dir /user/admin/foo
我已将mysql-connector-java-5.1.31-bin.jar
复制到/opt/cloudera/parcels/CDH-5.4.1-1.cdh5.4.1.p0.6/lib/sqoop/lib/
我遇到了这个错误
16/03/08 21:55:56 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `accessory` AS t LIMIT 1
16/03/08 21:55:56 ERROR manager.CatalogQueryManager: Failed to list columns from query: SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = (SELECT SCHEMA()) AND TABLE_NAME = 'foo'
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '()) AND TABLE_NAME = 'foo'' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
at com.mysql.jdbc.Util.getInstance(Util.java:383)
我能够解决这个问题。上面缺少驱动程序参数,这是导致问题的原因。下面的命令有效
sqoop import --connect jdbc:mysql://test.ddc:3306/test --table "foo" --driver
com.mysql.jdbc.Driver --username test --password bar --hive-table test.foo --
as-avrodatafile --target-dir /user/admin/foo
我从 sqoop 针对 mysql 数据库 (4.1.22-standard-log)
执行了这个简单的命令sqoop import --connect jdbc:mysql://test.ddc:3306/test --table "foo" --username test --password bar --hive -table test.foo --as-avrodatafile --target-dir /user/admin/foo
我已将mysql-connector-java-5.1.31-bin.jar
复制到/opt/cloudera/parcels/CDH-5.4.1-1.cdh5.4.1.p0.6/lib/sqoop/lib/
我遇到了这个错误
16/03/08 21:55:56 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `accessory` AS t LIMIT 1
16/03/08 21:55:56 ERROR manager.CatalogQueryManager: Failed to list columns from query: SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = (SELECT SCHEMA()) AND TABLE_NAME = 'foo'
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '()) AND TABLE_NAME = 'foo'' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
at com.mysql.jdbc.Util.getInstance(Util.java:383)
我能够解决这个问题。上面缺少驱动程序参数,这是导致问题的原因。下面的命令有效
sqoop import --connect jdbc:mysql://test.ddc:3306/test --table "foo" --driver
com.mysql.jdbc.Driver --username test --password bar --hive-table test.foo --
as-avrodatafile --target-dir /user/admin/foo