【问题标题】:Apache Scoop import qualified table from SQL ServerApache Sqoop 从 SQL Server 导入合格表
【发布时间】:2016-06-25 14:52:30
【问题描述】:

当我尝试使用从 SQL Server 导入表时

sqoop import \
  -m 1 \
 --connect jdbc:sqlserver://Arwen:1433 \
 --username=bods \
 --password=***\
 --table datamart.dbo.fct_txn
 --compression-codec=snappy \
 --as-avrodatafile \
 --warehouse-dir=/user/tkidb

sqoop 似乎创建了错误的查询语法。显然它需要一个不合格的表名。然后括号会起作用。如何解决这个问题?

16/06/25 07:44:55 INFO tool.CodeGenTool: Beginning code generation
16/06/25 07:44:57 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM [datamart.dbo.fct_txn] AS t WHERE 1=0
16/06/25 07:44:57 ERROR manager.SqlManager: Error executing statement: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'datamart.dbo.fct_txn'.

【问题讨论】:

    标签: sql-server cloudera sqoop


    【解决方案1】:

    基于错误日志中的查询:

    SELECT t.* FROM [datamart.dbo.fct_txn] AS t WHERE 1=0
    

    问题在于[datamart.dbo.fct_txn] 周围的引号中,正确的语法必须是[datamart].[dbo].[fct_txn]datamart.dbo.fct_txn。尝试更改两个字符串:

    --connect 'jdbc:sqlserver://Arwen:1433;database=datamart' \
    --table fct_txn
    

    如果datamart 是您尝试登录的用户的默认数据库,则仅更改 table 部分。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-13
      • 2020-12-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多