从data lake导出到azure slq server db时出现问题

7eumitmz  于 2021-06-03  发布在  Sqoop
关注(0)|答案(1)|浏览(347)

我正在尝试使用sqoop将数据从我的数据湖导出到我在azuresqlserver中设置的表中。这些都在azure数据工厂中。表的架构与文件名的架构匹配,但有一个例外…我在表中有一个名为'file\u name'的列,我想从文件本身填充该列(该字段不在原始数据中)。这是我试过的代码。

sqoop-export 
--connect "jdbc:sqlserver://server_name.database.windows.net:1433;username=user_name;password='pass word';database=db_name" 
--table REUTERS_CW 
--export-dir adl://rawdata/corp/file_name.gz 
--input-fields-terminated-by "|"

当我运行它时,我得到以下错误:

<console>:10: error: identifier expected but string literal found.
--input-fields-terminated-by "|"

有三件事我不确定。


# 1) My password actually has spaces in it; I think wrapping that in quotes will fix it.

# 2) I'm running this in Scala in Azure Databricks; I'm guessing that's oen way to do it, but I don't know for sure.

# 3) I'm not certain about how to copy the data from the file and simultaneously append the file name relative to the data that's supposed to be copied over.

我遵循下面链接中的示例。
https://docs.microsoft.com/en-us/azure/data-lake-store/data-lake-store-data-transfer-sql-sqoop

kr98yfug

kr98yfug1#

我从中得到了什么 sqoop-export 文档似乎不支持压缩文件。
您可以引用sqoop导出语法。
sqoop导出:

这个 --export-dir 论点和其中之一 --table 或者 --call 是必需的。它们指定要填充到数据库中的表(或要调用的存储过程)以及hdfs中包含源数据的目录。
sqoop导入:

希望这有帮助。

相关问题